9857174062861bc76ddbcbdcc7ea38e2dcab148c
[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 _0x8b8e=['error','code','message','result','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3fd50c,_0x1b41ed){var _0x4cebb2=function(_0x56a546){while(--_0x56a546){_0x3fd50c['push'](_0x3fd50c['shift']());}};_0x4cebb2(++_0x1b41ed);}(_0x8b8e,0x108));var _0xe8b8=function(_0x1612bc,_0x336f27){_0x1612bc=_0x1612bc-0x0;var _0x18cc60=_0x8b8e[_0x1612bc];return _0x18cc60;};'use strict';var _=require(_0xe8b8('0x0'));var util=require('util');var moment=require(_0xe8b8('0x1'));var BPromise=require('bluebird');var rs=require(_0xe8b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8b8('0x3'));var logger=require(_0xe8b8('0x4'))(_0xe8b8('0x5'));var config=require(_0xe8b8('0x6'));var jayson=require(_0xe8b8('0x7'));var client=jayson[_0xe8b8('0x8')][_0xe8b8('0x9')]({'port':0x232a});config[_0xe8b8('0xa')]=_[_0xe8b8('0xb')](config[_0xe8b8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8b8('0xc'))(new Redis(config['redis']));require(_0xe8b8('0xd'))['register'](socket);function respondWithRpcPromise(_0x48b59f,_0x2ccbeb,_0xcf1e01){return new BPromise(function(_0x568241,_0x54eb14){return client[_0xe8b8('0xe')](_0x48b59f,_0xcf1e01)[_0xe8b8('0xf')](function(_0x886a64){logger[_0xe8b8('0x10')](_0xe8b8('0x11'),_0x2ccbeb,_0xe8b8('0x12'));logger[_0xe8b8('0x13')](_0xe8b8('0x14'),_0x2ccbeb,_0xe8b8('0x12'),JSON[_0xe8b8('0x15')](_0x886a64));if(_0x886a64[_0xe8b8('0x16')]){if(_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x17')]===0x1f4){logger[_0xe8b8('0x16')]('UserProfile,\x20%s,\x20%s',_0x2ccbeb,_0x886a64[_0xe8b8('0x16')]['message']);return _0x54eb14(_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x18')]);}logger[_0xe8b8('0x16')](_0xe8b8('0x11'),_0x2ccbeb,_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x18')]);return _0x568241(_0x886a64[_0xe8b8('0x16')][_0xe8b8('0x18')]);}else{logger[_0xe8b8('0x10')](_0xe8b8('0x11'),_0x2ccbeb,'request\x20sent');_0x568241(_0x886a64[_0xe8b8('0x19')][_0xe8b8('0x18')]);}})['catch'](function(_0x35b573){logger[_0xe8b8('0x16')](_0xe8b8('0x11'),_0x2ccbeb,_0x35b573);_0x54eb14(_0x35b573);});});}