Built motion from commit b0a9a629.|2.6.33
[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 _0x68b3=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x68b3,0x1d8));var _0x368b=function(_0x56539e,_0x142068){_0x56539e=_0x56539e-0x0;var _0x4812d1=_0x68b3[_0x56539e];return _0x4812d1;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});config[_0x368b('0xc')]=_[_0x368b('0xd')](config[_0x368b('0xc')],{'host':_0x368b('0xe'),'port':0x18eb});var socket=require(_0x368b('0xf'))(new Redis(config[_0x368b('0xc')]));require(_0x368b('0x10'))[_0x368b('0x11')](socket);function respondWithRpcPromise(_0x5a46f9,_0x160e12,_0xdbd344){return new BPromise(function(_0x34a110,_0x51d513){return client[_0x368b('0x12')](_0x5a46f9,_0xdbd344)[_0x368b('0x13')](function(_0x253e4b){logger['info'](_0x368b('0x14'),_0x160e12,_0x368b('0x15'));logger['debug'](_0x368b('0x16'),_0x160e12,_0x368b('0x15'),JSON[_0x368b('0x17')](_0x253e4b));if(_0x253e4b[_0x368b('0x18')]){if(_0x253e4b[_0x368b('0x18')]['code']===0x1f4){logger[_0x368b('0x18')](_0x368b('0x14'),_0x160e12,_0x253e4b['error'][_0x368b('0x19')]);return _0x51d513(_0x253e4b[_0x368b('0x18')][_0x368b('0x19')]);}logger['error'](_0x368b('0x14'),_0x160e12,_0x253e4b[_0x368b('0x18')][_0x368b('0x19')]);return _0x34a110(_0x253e4b['error'][_0x368b('0x19')]);}else{logger[_0x368b('0x1a')](_0x368b('0x14'),_0x160e12,'request\x20sent');_0x34a110(_0x253e4b['result'][_0x368b('0x19')]);}})[_0x368b('0x1b')](function(_0x2c3cec){logger[_0x368b('0x18')](_0x368b('0x14'),_0x160e12,_0x2c3cec);_0x51d513(_0x2c3cec);});});}