Built motion from commit 092f8824.|2.5.49
[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 _0x3024=['../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0x3024,0x64));var _0x4302=function(_0x216303,_0x3074b6){_0x216303=_0x216303-0x0;var _0x3ab6af=_0x3024[_0x216303];return _0x3ab6af;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var moment=require('moment');var BPromise=require(_0x4302('0x2'));var rs=require(_0x4302('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4302('0x4'));var logger=require('../../config/logger')(_0x4302('0x5'));var config=require(_0x4302('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4302('0x7')][_0x4302('0x8')]({'port':0x232a});config['redis']=_[_0x4302('0x9')](config[_0x4302('0xa')],{'host':_0x4302('0xb'),'port':0x18eb});var socket=require(_0x4302('0xc'))(new Redis(config[_0x4302('0xa')]));require(_0x4302('0xd'))[_0x4302('0xe')](socket);function respondWithRpcPromise(_0x5630e5,_0x1a51bd,_0x34878d){return new BPromise(function(_0xe7d6b8,_0x493f5a){return client[_0x4302('0xf')](_0x5630e5,_0x34878d)[_0x4302('0x10')](function(_0x57722d){logger[_0x4302('0x11')](_0x4302('0x12'),_0x1a51bd,_0x4302('0x13'));logger['debug'](_0x4302('0x14'),_0x1a51bd,_0x4302('0x13'),JSON['stringify'](_0x57722d));if(_0x57722d[_0x4302('0x15')]){if(_0x57722d[_0x4302('0x15')][_0x4302('0x16')]===0x1f4){logger['error'](_0x4302('0x12'),_0x1a51bd,_0x57722d[_0x4302('0x15')]['message']);return _0x493f5a(_0x57722d[_0x4302('0x15')][_0x4302('0x17')]);}logger['error'](_0x4302('0x12'),_0x1a51bd,_0x57722d[_0x4302('0x15')][_0x4302('0x17')]);return _0xe7d6b8(_0x57722d[_0x4302('0x15')][_0x4302('0x17')]);}else{logger[_0x4302('0x11')](_0x4302('0x12'),_0x1a51bd,_0x4302('0x13'));_0xe7d6b8(_0x57722d[_0x4302('0x18')][_0x4302('0x17')]);}})[_0x4302('0x19')](function(_0x402eeb){logger[_0x4302('0x15')](_0x4302('0x12'),_0x1a51bd,_0x402eeb);_0x493f5a(_0x402eeb);});});}