Built motion from commit d1eab355.|2.6.28
[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 _0x06ae=['UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','request','then','info','UserProfile,\x20%s,\x20%s','debug'];(function(_0x16bb0e,_0x343132){var _0x102b8b=function(_0x17a62b){while(--_0x17a62b){_0x16bb0e['push'](_0x16bb0e['shift']());}};_0x102b8b(++_0x343132);}(_0x06ae,0x16e));var _0xe06a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x06ae[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xe06a('0x0'));var moment=require(_0xe06a('0x1'));var BPromise=require(_0xe06a('0x2'));var rs=require(_0xe06a('0x3'));var fs=require('fs');var Redis=require(_0xe06a('0x4'));var db=require(_0xe06a('0x5'))['db'];var utils=require(_0xe06a('0x6'));var logger=require(_0xe06a('0x7'))(_0xe06a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe06a('0x9')]({'port':0x232a});config[_0xe06a('0xa')]=_[_0xe06a('0xb')](config[_0xe06a('0xa')],{'host':_0xe06a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe06a('0xa')]));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x1a9f4e,_0x4eedc5,_0x2212e2){return new BPromise(function(_0x48e52a,_0x521741){return client[_0xe06a('0xd')](_0x1a9f4e,_0x2212e2)[_0xe06a('0xe')](function(_0x574fd0){logger[_0xe06a('0xf')](_0xe06a('0x10'),_0x4eedc5,'request\x20sent');logger[_0xe06a('0x11')](_0xe06a('0x12'),_0x4eedc5,_0xe06a('0x13'),JSON['stringify'](_0x574fd0));if(_0x574fd0[_0xe06a('0x14')]){if(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x15')]===0x1f4){logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0['error'][_0xe06a('0x16')]);return _0x521741(_0x574fd0[_0xe06a('0x14')][_0xe06a('0x16')]);}logger[_0xe06a('0x14')](_0xe06a('0x10'),_0x4eedc5,_0x574fd0[_0xe06a('0x14')]['message']);return _0x48e52a(_0x574fd0[_0xe06a('0x14')]['message']);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x4eedc5,_0xe06a('0x13'));_0x48e52a(_0x574fd0[_0xe06a('0x17')][_0xe06a('0x16')]);}})['catch'](function(_0x614743){logger[_0xe06a('0x14')]('UserProfile,\x20%s,\x20%s',_0x4eedc5,_0x614743);_0x521741(_0x614743);});});}