8a87562e1a6988913ab9b4a28d2d5d124804dd04
[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 _0xff22=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x570d93,_0x55a2fb){var _0x621e62=function(_0x1b848f){while(--_0x1b848f){_0x570d93['push'](_0x570d93['shift']());}};_0x621e62(++_0x55a2fb);}(_0xff22,0x1a0));var _0x2ff2=function(_0x1ff4d1,_0x4d09f2){_0x1ff4d1=_0x1ff4d1-0x0;var _0x1585d5=_0xff22[_0x1ff4d1];return _0x1585d5;};'use strict';var _=require(_0x2ff2('0x0'));var util=require(_0x2ff2('0x1'));var moment=require('moment');var BPromise=require(_0x2ff2('0x2'));var rs=require(_0x2ff2('0x3'));var fs=require('fs');var Redis=require(_0x2ff2('0x4'));var db=require(_0x2ff2('0x5'))['db'];var utils=require(_0x2ff2('0x6'));var logger=require(_0x2ff2('0x7'))(_0x2ff2('0x8'));var config=require(_0x2ff2('0x9'));var jayson=require(_0x2ff2('0xa'));var client=jayson['client'][_0x2ff2('0xb')]({'port':0x232a});config[_0x2ff2('0xc')]=_[_0x2ff2('0xd')](config[_0x2ff2('0xc')],{'host':_0x2ff2('0xe'),'port':0x18eb});var socket=require(_0x2ff2('0xf'))(new Redis(config[_0x2ff2('0xc')]));require('./userProfile.socket')[_0x2ff2('0x10')](socket);function respondWithRpcPromise(_0x820f1f,_0x15822a,_0x24e4b4){return new BPromise(function(_0x255028,_0x571fb3){return client['request'](_0x820f1f,_0x24e4b4)['then'](function(_0x421472){logger[_0x2ff2('0x11')](_0x2ff2('0x12'),_0x15822a,_0x2ff2('0x13'));logger[_0x2ff2('0x14')](_0x2ff2('0x15'),_0x15822a,_0x2ff2('0x13'),JSON['stringify'](_0x421472));if(_0x421472[_0x2ff2('0x16')]){if(_0x421472[_0x2ff2('0x16')][_0x2ff2('0x17')]===0x1f4){logger[_0x2ff2('0x16')](_0x2ff2('0x12'),_0x15822a,_0x421472['error']['message']);return _0x571fb3(_0x421472[_0x2ff2('0x16')]['message']);}logger[_0x2ff2('0x16')](_0x2ff2('0x12'),_0x15822a,_0x421472[_0x2ff2('0x16')][_0x2ff2('0x18')]);return _0x255028(_0x421472[_0x2ff2('0x16')][_0x2ff2('0x18')]);}else{logger[_0x2ff2('0x11')]('UserProfile,\x20%s,\x20%s',_0x15822a,_0x2ff2('0x13'));_0x255028(_0x421472['result'][_0x2ff2('0x18')]);}})[_0x2ff2('0x19')](function(_0xfd2c26){logger[_0x2ff2('0x16')](_0x2ff2('0x12'),_0x15822a,_0xfd2c26);_0x571fb3(_0xfd2c26);});});}