837282d87aca83618047eaa586da16d1a5265fdd
[motion2.git] / server / api / userProfile / userProfile.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x3acf13,_0x101871){var _0x4f5fa8=function(_0x5636dd){while(--_0x5636dd){_0x3acf13['push'](_0x3acf13['shift']());}};_0x4f5fa8(++_0x101871);}(_0x7c09,0x102));var _0x97c0=function(_0x67c53e,_0x5dfc62){_0x67c53e=_0x67c53e-0x0;var _0x210dd5=_0x7c09[_0x67c53e];return _0x210dd5;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x97c0('0x9')]=_[_0x97c0('0xa')](config[_0x97c0('0x9')],{'host':_0x97c0('0xb'),'port':0x18eb});var socket=require(_0x97c0('0xc'))(new Redis(config['redis']));require(_0x97c0('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d5507,_0x28cac4,_0x52bce2){return new BPromise(function(_0x50412f,_0x3ba42b){return client[_0x97c0('0xe')](_0x2d5507,_0x52bce2)[_0x97c0('0xf')](function(_0x238ed9){logger[_0x97c0('0x10')](_0x97c0('0x11'),_0x28cac4,_0x97c0('0x12'));logger[_0x97c0('0x13')](_0x97c0('0x14'),_0x28cac4,_0x97c0('0x12'),JSON[_0x97c0('0x15')](_0x238ed9));if(_0x238ed9[_0x97c0('0x16')]){if(_0x238ed9[_0x97c0('0x16')]['code']===0x1f4){logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x238ed9[_0x97c0('0x16')]['message']);return _0x3ba42b(_0x238ed9[_0x97c0('0x16')][_0x97c0('0x17')]);}logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x238ed9[_0x97c0('0x16')][_0x97c0('0x17')]);return _0x50412f(_0x238ed9['error'][_0x97c0('0x17')]);}else{logger[_0x97c0('0x10')]('UserProfile,\x20%s,\x20%s',_0x28cac4,_0x97c0('0x12'));_0x50412f(_0x238ed9[_0x97c0('0x18')][_0x97c0('0x17')]);}})[_0x97c0('0x19')](function(_0x183e2e){logger[_0x97c0('0x16')](_0x97c0('0x11'),_0x28cac4,_0x183e2e);_0x3ba42b(_0x183e2e);});});}