45be788b796c5385d67114f599fdc951fab3b79e
[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 _0xd86a=['error','message','result','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd86a,0xf3));var _0xad86=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xd86a[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xad86('0x0'));var util=require(_0xad86('0x1'));var moment=require(_0xad86('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad86('0x3'));var db=require(_0xad86('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xad86('0x5'));var config=require(_0xad86('0x6'));var jayson=require(_0xad86('0x7'));var client=jayson[_0xad86('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xad86('0x9')],{'host':_0xad86('0xa'),'port':0x18eb});var socket=require(_0xad86('0xb'))(new Redis(config[_0xad86('0x9')]));require(_0xad86('0xc'))[_0xad86('0xd')](socket);function respondWithRpcPromise(_0x3ff5c2,_0x58a7cc,_0x2f446f){return new BPromise(function(_0x382632,_0x378249){return client[_0xad86('0xe')](_0x3ff5c2,_0x2f446f)[_0xad86('0xf')](function(_0x5c87b4){logger[_0xad86('0x10')](_0xad86('0x11'),_0x58a7cc,'request\x20sent');logger[_0xad86('0x12')](_0xad86('0x13'),_0x58a7cc,'request\x20sent',JSON[_0xad86('0x14')](_0x5c87b4));if(_0x5c87b4['error']){if(_0x5c87b4[_0xad86('0x15')]['code']===0x1f4){logger[_0xad86('0x15')](_0xad86('0x11'),_0x58a7cc,_0x5c87b4['error'][_0xad86('0x16')]);return _0x378249(_0x5c87b4[_0xad86('0x15')]['message']);}logger[_0xad86('0x15')](_0xad86('0x11'),_0x58a7cc,_0x5c87b4[_0xad86('0x15')][_0xad86('0x16')]);return _0x382632(_0x5c87b4[_0xad86('0x15')][_0xad86('0x16')]);}else{logger[_0xad86('0x10')](_0xad86('0x11'),_0x58a7cc,'request\x20sent');_0x382632(_0x5c87b4[_0xad86('0x17')][_0xad86('0x16')]);}})['catch'](function(_0xe55083){logger['error']('UserProfile,\x20%s,\x20%s',_0x58a7cc,_0xe55083);_0x378249(_0xe55083);});});}