Built motion from commit 3c2ce842.|2.6.31
[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 _0xa3e8=['./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa3e8,0x127));var _0x8a3e=function(_0x2334ff,_0x237868){_0x2334ff=_0x2334ff-0x0;var _0x4c2c73=_0xa3e8[_0x2334ff];return _0x4c2c73;};'use strict';var _=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var moment=require(_0x8a3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a3e('0x3'));var fs=require('fs');var Redis=require(_0x8a3e('0x4'));var db=require(_0x8a3e('0x5'))['db'];var utils=require(_0x8a3e('0x6'));var logger=require(_0x8a3e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a3e('0x8')][_0x8a3e('0x9')]({'port':0x232a});config[_0x8a3e('0xa')]=_['defaults'](config[_0x8a3e('0xa')],{'host':_0x8a3e('0xb'),'port':0x18eb});var socket=require(_0x8a3e('0xc'))(new Redis(config[_0x8a3e('0xa')]));require(_0x8a3e('0xd'))[_0x8a3e('0xe')](socket);function respondWithRpcPromise(_0x350812,_0x1c8479,_0x23fd98){return new BPromise(function(_0x4e5699,_0x2a2eec){return client[_0x8a3e('0xf')](_0x350812,_0x23fd98)[_0x8a3e('0x10')](function(_0x4a9af4){logger[_0x8a3e('0x11')](_0x8a3e('0x12'),_0x1c8479,_0x8a3e('0x13'));logger[_0x8a3e('0x14')](_0x8a3e('0x15'),_0x1c8479,_0x8a3e('0x13'),JSON[_0x8a3e('0x16')](_0x4a9af4));if(_0x4a9af4[_0x8a3e('0x17')]){if(_0x4a9af4[_0x8a3e('0x17')][_0x8a3e('0x18')]===0x1f4){logger[_0x8a3e('0x17')](_0x8a3e('0x12'),_0x1c8479,_0x4a9af4[_0x8a3e('0x17')]['message']);return _0x2a2eec(_0x4a9af4[_0x8a3e('0x17')][_0x8a3e('0x19')]);}logger[_0x8a3e('0x17')](_0x8a3e('0x12'),_0x1c8479,_0x4a9af4[_0x8a3e('0x17')][_0x8a3e('0x19')]);return _0x4e5699(_0x4a9af4['error'][_0x8a3e('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x1c8479,_0x8a3e('0x13'));_0x4e5699(_0x4a9af4[_0x8a3e('0x1a')][_0x8a3e('0x19')]);}})[_0x8a3e('0x1b')](function(_0x24e88d){logger[_0x8a3e('0x17')](_0x8a3e('0x12'),_0x1c8479,_0x24e88d);_0x2a2eec(_0x24e88d);});});}