cc6160a964b53a12b1d2fb0d8bedf9726d335b86
[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 _0x307e=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x1115f1,_0x4c4008){var _0x523380=function(_0x41ab6c){while(--_0x41ab6c){_0x1115f1['push'](_0x1115f1['shift']());}};_0x523380(++_0x4c4008);}(_0x307e,0xc9));var _0xe307=function(_0x43e6bf,_0x47342a){_0x43e6bf=_0x43e6bf-0x0;var _0x1d93f6=_0x307e[_0x43e6bf];return _0x1d93f6;};'use strict';var _=require(_0xe307('0x0'));var util=require(_0xe307('0x1'));var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rs=require(_0xe307('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe307('0x5'))['db'];var utils=require(_0xe307('0x6'));var logger=require('../../config/logger')(_0xe307('0x7'));var config=require('../../config/environment');var jayson=require(_0xe307('0x8'));var client=jayson[_0xe307('0x9')][_0xe307('0xa')]({'port':0x232a});config['redis']=_[_0xe307('0xb')](config[_0xe307('0xc')],{'host':_0xe307('0xd'),'port':0x18eb});var socket=require(_0xe307('0xe'))(new Redis(config[_0xe307('0xc')]));require(_0xe307('0xf'))[_0xe307('0x10')](socket);function respondWithRpcPromise(_0x3ab559,_0x231b98,_0x393a82){return new BPromise(function(_0x217f0a,_0x4219b1){return client[_0xe307('0x11')](_0x3ab559,_0x393a82)[_0xe307('0x12')](function(_0xc521b8){logger[_0xe307('0x13')](_0xe307('0x14'),_0x231b98,_0xe307('0x15'));logger[_0xe307('0x16')](_0xe307('0x17'),_0x231b98,'request\x20sent',JSON[_0xe307('0x18')](_0xc521b8));if(_0xc521b8[_0xe307('0x19')]){if(_0xc521b8['error'][_0xe307('0x1a')]===0x1f4){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x4219b1(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}logger['error'](_0xe307('0x14'),_0x231b98,_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);return _0x217f0a(_0xc521b8[_0xe307('0x19')][_0xe307('0x1b')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x231b98,_0xe307('0x15'));_0x217f0a(_0xc521b8['result'][_0xe307('0x1b')]);}})[_0xe307('0x1c')](function(_0xe8354d){logger[_0xe307('0x19')](_0xe307('0x14'),_0x231b98,_0xe8354d);_0x4219b1(_0xe8354d);});});}