5560d3b30fb15913f29e42341220c39545b5a01c
[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 _0x4819=['defaults','redis','localhost','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x42f48d,_0x22f211){var _0xf73140=function(_0x12b025){while(--_0x12b025){_0x42f48d['push'](_0x42f48d['shift']());}};_0xf73140(++_0x22f211);}(_0x4819,0xcd));var _0x9481=function(_0x51f40e,_0x14e8ea){_0x51f40e=_0x51f40e-0x0;var _0xb37761=_0x4819[_0x51f40e];return _0xb37761;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var Redis=require(_0x9481('0x4'));var db=require(_0x9481('0x5'))['db'];var utils=require(_0x9481('0x6'));var logger=require(_0x9481('0x7'))(_0x9481('0x8'));var config=require(_0x9481('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9481('0xa')]['http']({'port':0x232a});config['redis']=_[_0x9481('0xb')](config[_0x9481('0xc')],{'host':_0x9481('0xd'),'port':0x18eb});var socket=require(_0x9481('0xe'))(new Redis(config[_0x9481('0xc')]));require('./userProfile.socket')[_0x9481('0xf')](socket);function respondWithRpcPromise(_0x521d18,_0x2fabf1,_0x564d5b){return new BPromise(function(_0x411d24,_0x2d5d0f){return client[_0x9481('0x10')](_0x521d18,_0x564d5b)[_0x9481('0x11')](function(_0xe84f77){logger[_0x9481('0x12')](_0x9481('0x13'),_0x2fabf1,_0x9481('0x14'));logger[_0x9481('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2fabf1,'request\x20sent',JSON[_0x9481('0x16')](_0xe84f77));if(_0xe84f77[_0x9481('0x17')]){if(_0xe84f77[_0x9481('0x17')][_0x9481('0x18')]===0x1f4){logger[_0x9481('0x17')](_0x9481('0x13'),_0x2fabf1,_0xe84f77[_0x9481('0x17')]['message']);return _0x2d5d0f(_0xe84f77[_0x9481('0x17')][_0x9481('0x19')]);}logger['error'](_0x9481('0x13'),_0x2fabf1,_0xe84f77['error'][_0x9481('0x19')]);return _0x411d24(_0xe84f77[_0x9481('0x17')][_0x9481('0x19')]);}else{logger[_0x9481('0x12')]('UserProfile,\x20%s,\x20%s',_0x2fabf1,'request\x20sent');_0x411d24(_0xe84f77[_0x9481('0x1a')]['message']);}})['catch'](function(_0x26671c){logger[_0x9481('0x17')](_0x9481('0x13'),_0x2fabf1,_0x26671c);_0x2d5d0f(_0x26671c);});});}