6ba59f551e1714b744b60e15c7fb415b7df049c6
[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 _0x13f5=['debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0xf26ff9,_0x19db58){var _0xcc478b=function(_0x477168){while(--_0x477168){_0xf26ff9['push'](_0xf26ff9['shift']());}};_0xcc478b(++_0x19db58);}(_0x13f5,0xc3));var _0x513f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x13f5[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var moment=require(_0x513f('0x2'));var BPromise=require(_0x513f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x513f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x513f('0x5'))(_0x513f('0x6'));var config=require(_0x513f('0x7'));var jayson=require(_0x513f('0x8'));var client=jayson[_0x513f('0x9')][_0x513f('0xa')]({'port':0x232a});config[_0x513f('0xb')]=_[_0x513f('0xc')](config[_0x513f('0xb')],{'host':_0x513f('0xd'),'port':0x18eb});var socket=require(_0x513f('0xe'))(new Redis(config[_0x513f('0xb')]));require('./userProfile.socket')[_0x513f('0xf')](socket);function respondWithRpcPromise(_0x38bd4b,_0x443bde,_0x4efd8b){return new BPromise(function(_0x88288b,_0x4aa878){return client[_0x513f('0x10')](_0x38bd4b,_0x4efd8b)[_0x513f('0x11')](function(_0x484ab1){logger[_0x513f('0x12')](_0x513f('0x13'),_0x443bde,_0x513f('0x14'));logger[_0x513f('0x15')](_0x513f('0x16'),_0x443bde,_0x513f('0x14'),JSON[_0x513f('0x17')](_0x484ab1));if(_0x484ab1[_0x513f('0x18')]){if(_0x484ab1[_0x513f('0x18')][_0x513f('0x19')]===0x1f4){logger[_0x513f('0x18')](_0x513f('0x13'),_0x443bde,_0x484ab1[_0x513f('0x18')][_0x513f('0x1a')]);return _0x4aa878(_0x484ab1['error'][_0x513f('0x1a')]);}logger['error'](_0x513f('0x13'),_0x443bde,_0x484ab1[_0x513f('0x18')][_0x513f('0x1a')]);return _0x88288b(_0x484ab1[_0x513f('0x18')][_0x513f('0x1a')]);}else{logger['info'](_0x513f('0x13'),_0x443bde,_0x513f('0x14'));_0x88288b(_0x484ab1['result'][_0x513f('0x1a')]);}})['catch'](function(_0x2c13d6){logger[_0x513f('0x18')]('UserProfile,\x20%s,\x20%s',_0x443bde,_0x2c13d6);_0x4aa878(_0x2c13d6);});});}