3e127ff0d9ee3e189c78af5b6074e91250ecfa51
[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 _0x7af9=['rpc','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27b0b3,_0x5c69cf){var _0x3489c0=function(_0x4e6112){while(--_0x4e6112){_0x27b0b3['push'](_0x27b0b3['shift']());}};_0x3489c0(++_0x5c69cf);}(_0x7af9,0x95));var _0x97af=function(_0x550c99,_0x45f541){_0x550c99=_0x550c99-0x0;var _0x273815=_0x7af9[_0x550c99];return _0x273815;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});config[_0x97af('0x9')]=_[_0x97af('0xa')](config[_0x97af('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x97af('0xb'))(new Redis(config[_0x97af('0x9')]));require(_0x97af('0xc'))['register'](socket);function respondWithRpcPromise(_0x175bbc,_0x5cd1e0,_0x46ac08){return new BPromise(function(_0x19ad23,_0x18a9e5){return client[_0x97af('0xd')](_0x175bbc,_0x46ac08)[_0x97af('0xe')](function(_0x3cc156){logger[_0x97af('0xf')](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));logger[_0x97af('0x12')](_0x97af('0x13'),_0x5cd1e0,'request\x20sent',JSON[_0x97af('0x14')](_0x3cc156));if(_0x3cc156['error']){if(_0x3cc156['error'][_0x97af('0x15')]===0x1f4){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);return _0x18a9e5(_0x3cc156[_0x97af('0x16')][_0x97af('0x17')]);}logger['error'](_0x97af('0x10'),_0x5cd1e0,_0x3cc156['error'][_0x97af('0x17')]);return _0x19ad23(_0x3cc156['error'][_0x97af('0x17')]);}else{logger['info'](_0x97af('0x10'),_0x5cd1e0,_0x97af('0x11'));_0x19ad23(_0x3cc156[_0x97af('0x18')][_0x97af('0x17')]);}})[_0x97af('0x19')](function(_0x5ad2bc){logger[_0x97af('0x16')](_0x97af('0x10'),_0x5cd1e0,_0x5ad2bc);_0x18a9e5(_0x5ad2bc);});});}