24994033712c1656b02765e9656afd2ff04a7ee0
[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 _0x9c5a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','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'];(function(_0x5b7e51,_0x28c84f){var _0x41293d=function(_0x105876){while(--_0x105876){_0x5b7e51['push'](_0x5b7e51['shift']());}};_0x41293d(++_0x28c84f);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x4fd2ee,_0x3524bb){_0x4fd2ee=_0x4fd2ee-0x0;var _0x911814=_0x9c5a[_0x4fd2ee];return _0x911814;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});config[_0xa9c5('0xa')]=_['defaults'](config['redis'],{'host':_0xa9c5('0xb'),'port':0x18eb});var socket=require(_0xa9c5('0xc'))(new Redis(config['redis']));require(_0xa9c5('0xd'))[_0xa9c5('0xe')](socket);function respondWithRpcPromise(_0x51c14c,_0x2e4f45,_0x40a79d){return new BPromise(function(_0x4a19c0,_0x4c55e9){return client[_0xa9c5('0xf')](_0x51c14c,_0x40a79d)[_0xa9c5('0x10')](function(_0x45f8d8){logger[_0xa9c5('0x11')](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));logger[_0xa9c5('0x14')](_0xa9c5('0x15'),_0x2e4f45,_0xa9c5('0x13'),JSON[_0xa9c5('0x16')](_0x45f8d8));if(_0x45f8d8['error']){if(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x18')]===0x1f4){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);return _0x4c55e9(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x45f8d8['error'][_0xa9c5('0x19')]);return _0x4a19c0(_0x45f8d8[_0xa9c5('0x17')][_0xa9c5('0x19')]);}else{logger['info'](_0xa9c5('0x12'),_0x2e4f45,_0xa9c5('0x13'));_0x4a19c0(_0x45f8d8[_0xa9c5('0x1a')][_0xa9c5('0x19')]);}})[_0xa9c5('0x1b')](function(_0x349f27){logger[_0xa9c5('0x17')](_0xa9c5('0x12'),_0x2e4f45,_0x349f27);_0x4c55e9(_0x349f27);});});}