bda4df16bc0396d54126a6ad28293dc5da44ba21
[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 _0x24ca=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x13880a,_0x8aa5a0){var _0x43f91a=function(_0x2197ae){while(--_0x2197ae){_0x13880a['push'](_0x13880a['shift']());}};_0x43f91a(++_0x8aa5a0);}(_0x24ca,0x1bc));var _0xa24c=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x24ca[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});config[_0xa24c('0xc')]=_[_0xa24c('0xd')](config[_0xa24c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0xe'))(new Redis(config[_0xa24c('0xc')]));require(_0xa24c('0xf'))['register'](socket);function respondWithRpcPromise(_0x399f32,_0x325c6d,_0x288f76){return new BPromise(function(_0x211003,_0x169632){return client[_0xa24c('0x10')](_0x399f32,_0x288f76)[_0xa24c('0x11')](function(_0xc82af0){logger[_0xa24c('0x12')]('UserProfile,\x20%s,\x20%s',_0x325c6d,_0xa24c('0x13'));logger[_0xa24c('0x14')](_0xa24c('0x15'),_0x325c6d,_0xa24c('0x13'),JSON['stringify'](_0xc82af0));if(_0xc82af0[_0xa24c('0x16')]){if(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x17')]===0x1f4){logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);return _0x169632(_0xc82af0['error']['message']);}logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0['error']['message']);return _0x211003(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);}else{logger['info'](_0xa24c('0x18'),_0x325c6d,'request\x20sent');_0x211003(_0xc82af0[_0xa24c('0x1a')][_0xa24c('0x19')]);}})[_0xa24c('0x1b')](function(_0xefdbd9){logger['error'](_0xa24c('0x18'),_0x325c6d,_0xefdbd9);_0x169632(_0xefdbd9);});});}