7317061719a810b0ec5bc7dd72b57d8759b52903
[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 _0x6c14=['socket.io-emitter','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6c14,0xd1));var _0x46c1=function(_0x7c38f7,_0x57e345){_0x7c38f7=_0x7c38f7-0x0;var _0x1568ce=_0x6c14[_0x7c38f7];return _0x1568ce;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var moment=require(_0x46c1('0x2'));var BPromise=require(_0x46c1('0x3'));var rs=require(_0x46c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x46c1('0x5'))['db'];var utils=require(_0x46c1('0x6'));var logger=require(_0x46c1('0x7'))('rpc');var config=require(_0x46c1('0x8'));var jayson=require(_0x46c1('0x9'));var client=jayson[_0x46c1('0xa')][_0x46c1('0xb')]({'port':0x232a});config[_0x46c1('0xc')]=_[_0x46c1('0xd')](config[_0x46c1('0xc')],{'host':_0x46c1('0xe'),'port':0x18eb});var socket=require(_0x46c1('0xf'))(new Redis(config['redis']));require(_0x46c1('0x10'))[_0x46c1('0x11')](socket);function respondWithRpcPromise(_0x28fae2,_0x5e999d,_0x42af02){return new BPromise(function(_0x3676e3,_0x2c718c){return client['request'](_0x28fae2,_0x42af02)[_0x46c1('0x12')](function(_0x2e9325){logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,'request\x20sent');logger[_0x46c1('0x15')](_0x46c1('0x16'),_0x5e999d,'request\x20sent',JSON['stringify'](_0x2e9325));if(_0x2e9325[_0x46c1('0x17')]){if(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x18')]===0x1f4){logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error'][_0x46c1('0x19')]);return _0x2c718c(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}logger[_0x46c1('0x17')](_0x46c1('0x14'),_0x5e999d,_0x2e9325['error']['message']);return _0x3676e3(_0x2e9325[_0x46c1('0x17')][_0x46c1('0x19')]);}else{logger[_0x46c1('0x13')](_0x46c1('0x14'),_0x5e999d,_0x46c1('0x1a'));_0x3676e3(_0x2e9325[_0x46c1('0x1b')][_0x46c1('0x19')]);}})['catch'](function(_0x247a8b){logger[_0x46c1('0x17')]('UserProfile,\x20%s,\x20%s',_0x5e999d,_0x247a8b);_0x2c718c(_0x247a8b);});});}