Built motion from commit 746c7d2a.|2.5.35
[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 _0xe6e9=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe6e9,0x182));var _0x9e6e=function(_0x56d74b,_0x447c5c){_0x56d74b=_0x56d74b-0x0;var _0x2227b7=_0xe6e9[_0x56d74b];return _0x2227b7;};'use strict';var _=require(_0x9e6e('0x0'));var util=require(_0x9e6e('0x1'));var moment=require(_0x9e6e('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e6e('0x3'));var fs=require('fs');var Redis=require(_0x9e6e('0x4'));var db=require(_0x9e6e('0x5'))['db'];var utils=require(_0x9e6e('0x6'));var logger=require(_0x9e6e('0x7'))('rpc');var config=require(_0x9e6e('0x8'));var jayson=require(_0x9e6e('0x9'));var client=jayson[_0x9e6e('0xa')][_0x9e6e('0xb')]({'port':0x232a});config[_0x9e6e('0xc')]=_['defaults'](config[_0x9e6e('0xc')],{'host':_0x9e6e('0xd'),'port':0x18eb});var socket=require(_0x9e6e('0xe'))(new Redis(config[_0x9e6e('0xc')]));require(_0x9e6e('0xf'))[_0x9e6e('0x10')](socket);function respondWithRpcPromise(_0x4862cb,_0x1b683d,_0x40360d){return new BPromise(function(_0x286351,_0xbf2d04){return client['request'](_0x4862cb,_0x40360d)[_0x9e6e('0x11')](function(_0x4697d1){logger['info'](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));logger[_0x9e6e('0x14')](_0x9e6e('0x15'),_0x1b683d,'request\x20sent',JSON[_0x9e6e('0x16')](_0x4697d1));if(_0x4697d1[_0x9e6e('0x17')]){if(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x18')]===0x1f4){logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0xbf2d04(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}logger[_0x9e6e('0x17')](_0x9e6e('0x12'),_0x1b683d,_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);return _0x286351(_0x4697d1[_0x9e6e('0x17')][_0x9e6e('0x19')]);}else{logger[_0x9e6e('0x1a')](_0x9e6e('0x12'),_0x1b683d,_0x9e6e('0x13'));_0x286351(_0x4697d1[_0x9e6e('0x1b')][_0x9e6e('0x19')]);}})['catch'](function(_0x54ba62){logger['error'](_0x9e6e('0x12'),_0x1b683d,_0x54ba62);_0xbf2d04(_0x54ba62);});});}