9dd5157c9753fc5d583d71294f21279025768d81
[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 _0xe1d3=['../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x56d6f4,_0xc4abd9){var _0x305f48=function(_0x2dae95){while(--_0x2dae95){_0x56d6f4['push'](_0x56d6f4['shift']());}};_0x305f48(++_0xc4abd9);}(_0xe1d3,0x159));var _0x3e1d=function(_0x45ae88,_0x4c23a2){_0x45ae88=_0x45ae88-0x0;var _0x715583=_0xe1d3[_0x45ae88];return _0x715583;};'use strict';var _=require(_0x3e1d('0x0'));var util=require(_0x3e1d('0x1'));var moment=require(_0x3e1d('0x2'));var BPromise=require(_0x3e1d('0x3'));var rs=require(_0x3e1d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1d('0x6'))(_0x3e1d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e1d('0x8')][_0x3e1d('0x9')]({'port':0x232a});config[_0x3e1d('0xa')]=_[_0x3e1d('0xb')](config[_0x3e1d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e1d('0xc'))(new Redis(config[_0x3e1d('0xa')]));require('./userProfile.socket')[_0x3e1d('0xd')](socket);function respondWithRpcPromise(_0x102dfc,_0x7259db,_0x3c49f0){return new BPromise(function(_0x209a4e,_0x27bb9a){return client[_0x3e1d('0xe')](_0x102dfc,_0x3c49f0)[_0x3e1d('0xf')](function(_0x2d0595){logger[_0x3e1d('0x10')](_0x3e1d('0x11'),_0x7259db,_0x3e1d('0x12'));logger[_0x3e1d('0x13')](_0x3e1d('0x14'),_0x7259db,'request\x20sent',JSON[_0x3e1d('0x15')](_0x2d0595));if(_0x2d0595[_0x3e1d('0x16')]){if(_0x2d0595['error'][_0x3e1d('0x17')]===0x1f4){logger[_0x3e1d('0x16')]('UserProfile,\x20%s,\x20%s',_0x7259db,_0x2d0595[_0x3e1d('0x16')][_0x3e1d('0x18')]);return _0x27bb9a(_0x2d0595[_0x3e1d('0x16')][_0x3e1d('0x18')]);}logger[_0x3e1d('0x16')]('UserProfile,\x20%s,\x20%s',_0x7259db,_0x2d0595[_0x3e1d('0x16')][_0x3e1d('0x18')]);return _0x209a4e(_0x2d0595['error'][_0x3e1d('0x18')]);}else{logger[_0x3e1d('0x10')]('UserProfile,\x20%s,\x20%s',_0x7259db,_0x3e1d('0x12'));_0x209a4e(_0x2d0595[_0x3e1d('0x19')][_0x3e1d('0x18')]);}})[_0x3e1d('0x1a')](function(_0x1064bd){logger[_0x3e1d('0x16')]('UserProfile,\x20%s,\x20%s',_0x7259db,_0x1064bd);_0x27bb9a(_0x1064bd);});});}