bea5e98f3706e9a4ba05b1b4162cf6d0b049fddb
[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 _0xd386=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x3d8ef7,_0x25f8b0){var _0x509073=function(_0x23f7c7){while(--_0x23f7c7){_0x3d8ef7['push'](_0x3d8ef7['shift']());}};_0x509073(++_0x25f8b0);}(_0xd386,0x10c));var _0x6d38=function(_0x7f6e9,_0x2cf772){_0x7f6e9=_0x7f6e9-0x0;var _0x5a3124=_0xd386[_0x7f6e9];return _0x5a3124;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var moment=require(_0x6d38('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d38('0x3'));var fs=require('fs');var Redis=require(_0x6d38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d38('0x5'));var logger=require(_0x6d38('0x6'))(_0x6d38('0x7'));var config=require(_0x6d38('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d38('0x9')][_0x6d38('0xa')]({'port':0x232a});config[_0x6d38('0xb')]=_[_0x6d38('0xc')](config[_0x6d38('0xb')],{'host':_0x6d38('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d38('0xb')]));require('./userProfile.socket')[_0x6d38('0xe')](socket);function respondWithRpcPromise(_0x4909e0,_0x171f76,_0x29c14b){return new BPromise(function(_0x23c9ba,_0x5dfc29){return client[_0x6d38('0xf')](_0x4909e0,_0x29c14b)[_0x6d38('0x10')](function(_0x404a35){logger['info']('UserProfile,\x20%s,\x20%s',_0x171f76,'request\x20sent');logger[_0x6d38('0x11')](_0x6d38('0x12'),_0x171f76,_0x6d38('0x13'),JSON[_0x6d38('0x14')](_0x404a35));if(_0x404a35[_0x6d38('0x15')]){if(_0x404a35['error'][_0x6d38('0x16')]===0x1f4){logger[_0x6d38('0x15')](_0x6d38('0x17'),_0x171f76,_0x404a35[_0x6d38('0x15')][_0x6d38('0x18')]);return _0x5dfc29(_0x404a35[_0x6d38('0x15')][_0x6d38('0x18')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x171f76,_0x404a35['error'][_0x6d38('0x18')]);return _0x23c9ba(_0x404a35[_0x6d38('0x15')][_0x6d38('0x18')]);}else{logger[_0x6d38('0x19')](_0x6d38('0x17'),_0x171f76,_0x6d38('0x13'));_0x23c9ba(_0x404a35['result'][_0x6d38('0x18')]);}})[_0x6d38('0x1a')](function(_0x364d22){logger[_0x6d38('0x15')](_0x6d38('0x17'),_0x171f76,_0x364d22);_0x5dfc29(_0x364d22);});});}