Built motion from commit 4fa9d4a7.|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 _0xe1c4=['http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','client'];(function(_0xa07178,_0x3e6d1c){var _0x2e4eb9=function(_0x214f62){while(--_0x214f62){_0xa07178['push'](_0xa07178['shift']());}};_0x2e4eb9(++_0x3e6d1c);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x5466e0,_0x586206){_0x5466e0=_0x5466e0-0x0;var _0xf32c89=_0xe1c4[_0x5466e0];return _0xf32c89;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var moment=require(_0x4e1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e1c('0x4'));var logger=require(_0x4e1c('0x5'))(_0x4e1c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e1c('0x7')][_0x4e1c('0x8')]({'port':0x232a});config[_0x4e1c('0x9')]=_[_0x4e1c('0xa')](config[_0x4e1c('0x9')],{'host':_0x4e1c('0xb'),'port':0x18eb});var socket=require(_0x4e1c('0xc'))(new Redis(config[_0x4e1c('0x9')]));require(_0x4e1c('0xd'))[_0x4e1c('0xe')](socket);function respondWithRpcPromise(_0x2290b4,_0x1b6b8f,_0x207458){return new BPromise(function(_0x4fc396,_0x37b5fd){return client[_0x4e1c('0xf')](_0x2290b4,_0x207458)['then'](function(_0x2fbf2d){logger[_0x4e1c('0x10')](_0x4e1c('0x11'),_0x1b6b8f,_0x4e1c('0x12'));logger['debug'](_0x4e1c('0x13'),_0x1b6b8f,_0x4e1c('0x12'),JSON[_0x4e1c('0x14')](_0x2fbf2d));if(_0x2fbf2d[_0x4e1c('0x15')]){if(_0x2fbf2d['error']['code']===0x1f4){logger['error'](_0x4e1c('0x11'),_0x1b6b8f,_0x2fbf2d[_0x4e1c('0x15')][_0x4e1c('0x16')]);return _0x37b5fd(_0x2fbf2d[_0x4e1c('0x15')]['message']);}logger[_0x4e1c('0x15')](_0x4e1c('0x11'),_0x1b6b8f,_0x2fbf2d[_0x4e1c('0x15')][_0x4e1c('0x16')]);return _0x4fc396(_0x2fbf2d[_0x4e1c('0x15')][_0x4e1c('0x16')]);}else{logger['info'](_0x4e1c('0x11'),_0x1b6b8f,_0x4e1c('0x12'));_0x4fc396(_0x2fbf2d[_0x4e1c('0x17')][_0x4e1c('0x16')]);}})[_0x4e1c('0x18')](function(_0x4433d2){logger[_0x4e1c('0x15')]('UserProfile,\x20%s,\x20%s',_0x1b6b8f,_0x4433d2);_0x37b5fd(_0x4433d2);});});}