f170c1a44521a4c37043e61feb1a220900cfc5bf
[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 _0x8ef6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x115f14,_0x1242e8){var _0x1785ee=function(_0x59bb05){while(--_0x59bb05){_0x115f14['push'](_0x115f14['shift']());}};_0x1785ee(++_0x1242e8);}(_0x8ef6,0xf2));var _0x68ef=function(_0x488545,_0x5b222c){_0x488545=_0x488545-0x0;var _0x3a0bb5=_0x8ef6[_0x488545];return _0x3a0bb5;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x68ef('0xb')]=_[_0x68ef('0xc')](config[_0x68ef('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x68ef('0xd'))(new Redis(config[_0x68ef('0xb')]));require(_0x68ef('0xe'))[_0x68ef('0xf')](socket);function respondWithRpcPromise(_0x112b18,_0x51554d,_0x304a60){return new BPromise(function(_0x23da00,_0x1f6747){return client[_0x68ef('0x10')](_0x112b18,_0x304a60)[_0x68ef('0x11')](function(_0xfa6763){logger['info'](_0x68ef('0x12'),_0x51554d,_0x68ef('0x13'));logger[_0x68ef('0x14')](_0x68ef('0x15'),_0x51554d,_0x68ef('0x13'),JSON[_0x68ef('0x16')](_0xfa6763));if(_0xfa6763['error']){if(_0xfa6763[_0x68ef('0x17')][_0x68ef('0x18')]===0x1f4){logger[_0x68ef('0x17')]('UserProfile,\x20%s,\x20%s',_0x51554d,_0xfa6763[_0x68ef('0x17')][_0x68ef('0x19')]);return _0x1f6747(_0xfa6763[_0x68ef('0x17')]['message']);}logger[_0x68ef('0x17')](_0x68ef('0x12'),_0x51554d,_0xfa6763[_0x68ef('0x17')][_0x68ef('0x19')]);return _0x23da00(_0xfa6763['error'][_0x68ef('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x51554d,_0x68ef('0x13'));_0x23da00(_0xfa6763[_0x68ef('0x1a')]['message']);}})['catch'](function(_0x3c4c1f){logger[_0x68ef('0x17')](_0x68ef('0x12'),_0x51554d,_0x3c4c1f);_0x1f6747(_0x3c4c1f);});});}