Built motion from commit 87cd5f02.|2.5.48
[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 _0xb242=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb242,0x1f3));var _0x2b24=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xb242[_0x469a3c];return _0x968f4;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var moment=require(_0x2b24('0x1'));var BPromise=require(_0x2b24('0x2'));var rs=require(_0x2b24('0x3'));var fs=require('fs');var Redis=require(_0x2b24('0x4'));var db=require(_0x2b24('0x5'))['db'];var utils=require(_0x2b24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b24('0x7'));var jayson=require(_0x2b24('0x8'));var client=jayson['client'][_0x2b24('0x9')]({'port':0x232a});config[_0x2b24('0xa')]=_[_0x2b24('0xb')](config['redis'],{'host':_0x2b24('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b24('0xa')]));require(_0x2b24('0xd'))['register'](socket);function respondWithRpcPromise(_0x280030,_0x56dd79,_0x24efd2){return new BPromise(function(_0x12a5cb,_0x5e219d){return client['request'](_0x280030,_0x24efd2)[_0x2b24('0xe')](function(_0x4ab047){logger[_0x2b24('0xf')](_0x2b24('0x10'),_0x56dd79,_0x2b24('0x11'));logger[_0x2b24('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x56dd79,'request\x20sent',JSON[_0x2b24('0x13')](_0x4ab047));if(_0x4ab047[_0x2b24('0x14')]){if(_0x4ab047[_0x2b24('0x14')][_0x2b24('0x15')]===0x1f4){logger[_0x2b24('0x14')]('UserProfile,\x20%s,\x20%s',_0x56dd79,_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);return _0x5e219d(_0x4ab047['error'][_0x2b24('0x16')]);}logger[_0x2b24('0x14')]('UserProfile,\x20%s,\x20%s',_0x56dd79,_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);return _0x12a5cb(_0x4ab047[_0x2b24('0x14')][_0x2b24('0x16')]);}else{logger['info'](_0x2b24('0x10'),_0x56dd79,_0x2b24('0x11'));_0x12a5cb(_0x4ab047[_0x2b24('0x17')]['message']);}})[_0x2b24('0x18')](function(_0xa45843){logger[_0x2b24('0x14')]('UserProfile,\x20%s,\x20%s',_0x56dd79,_0xa45843);_0x5e219d(_0xa45843);});});}