35d33d5ba58aeab2826ab32986e1faaf10ef6d2d
[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 _0xfaf2=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','request','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x44b9a,_0x587332){var _0x56b5ac=function(_0x550a92){while(--_0x550a92){_0x44b9a['push'](_0x44b9a['shift']());}};_0x56b5ac(++_0x587332);}(_0xfaf2,0x169));var _0x2faf=function(_0x3cd3f8,_0x2c791c){_0x3cd3f8=_0x3cd3f8-0x0;var _0x409320=_0xfaf2[_0x3cd3f8];return _0x409320;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var moment=require(_0x2faf('0x2'));var BPromise=require(_0x2faf('0x3'));var rs=require(_0x2faf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2faf('0x5'))['db'];var utils=require(_0x2faf('0x6'));var logger=require(_0x2faf('0x7'))(_0x2faf('0x8'));var config=require(_0x2faf('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x2faf('0xa')]=_[_0x2faf('0xb')](config[_0x2faf('0xa')],{'host':_0x2faf('0xc'),'port':0x18eb});var socket=require(_0x2faf('0xd'))(new Redis(config['redis']));require('./userProfile.socket')[_0x2faf('0xe')](socket);function respondWithRpcPromise(_0x262959,_0x4ca336,_0x4f041a){return new BPromise(function(_0x3ec8cc,_0x3fa4b0){return client[_0x2faf('0xf')](_0x262959,_0x4f041a)['then'](function(_0x515eb6){logger[_0x2faf('0x10')](_0x2faf('0x11'),_0x4ca336,'request\x20sent');logger[_0x2faf('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x4ca336,_0x2faf('0x13'),JSON[_0x2faf('0x14')](_0x515eb6));if(_0x515eb6[_0x2faf('0x15')]){if(_0x515eb6[_0x2faf('0x15')][_0x2faf('0x16')]===0x1f4){logger[_0x2faf('0x15')]('UserProfile,\x20%s,\x20%s',_0x4ca336,_0x515eb6[_0x2faf('0x15')][_0x2faf('0x17')]);return _0x3fa4b0(_0x515eb6['error'][_0x2faf('0x17')]);}logger[_0x2faf('0x15')](_0x2faf('0x11'),_0x4ca336,_0x515eb6[_0x2faf('0x15')]['message']);return _0x3ec8cc(_0x515eb6[_0x2faf('0x15')][_0x2faf('0x17')]);}else{logger[_0x2faf('0x10')](_0x2faf('0x11'),_0x4ca336,'request\x20sent');_0x3ec8cc(_0x515eb6[_0x2faf('0x18')][_0x2faf('0x17')]);}})[_0x2faf('0x19')](function(_0x2b226b){logger[_0x2faf('0x15')](_0x2faf('0x11'),_0x4ca336,_0x2b226b);_0x3fa4b0(_0x2b226b);});});}