Built motion from commit bab6f49e.|2.6.17
[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 _0x0650=['register','request','then','info','debug','stringify','error','UserProfile,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','socket.io-emitter','./userProfile.socket'];(function(_0x5f584a,_0x47f064){var _0x3788d9=function(_0x29c10b){while(--_0x29c10b){_0x5f584a['push'](_0x5f584a['shift']());}};_0x3788d9(++_0x47f064);}(_0x0650,0x1aa));var _0x0065=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x0650[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0x0065('0x0'));var util=require(_0x0065('0x1'));var moment=require(_0x0065('0x2'));var BPromise=require(_0x0065('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require(_0x0065('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0065('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0065('0x9'))(new Redis(config['redis']));require(_0x0065('0xa'))[_0x0065('0xb')](socket);function respondWithRpcPromise(_0x4a72bf,_0x2afe89,_0x41e9de){return new BPromise(function(_0x49ef12,_0x535a92){return client[_0x0065('0xc')](_0x4a72bf,_0x41e9de)[_0x0065('0xd')](function(_0x2ba986){logger[_0x0065('0xe')]('UserProfile,\x20%s,\x20%s',_0x2afe89,'request\x20sent');logger[_0x0065('0xf')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2afe89,'request\x20sent',JSON[_0x0065('0x10')](_0x2ba986));if(_0x2ba986['error']){if(_0x2ba986[_0x0065('0x11')]['code']===0x1f4){logger['error'](_0x0065('0x12'),_0x2afe89,_0x2ba986[_0x0065('0x11')][_0x0065('0x13')]);return _0x535a92(_0x2ba986[_0x0065('0x11')][_0x0065('0x13')]);}logger[_0x0065('0x11')](_0x0065('0x12'),_0x2afe89,_0x2ba986[_0x0065('0x11')]['message']);return _0x49ef12(_0x2ba986[_0x0065('0x11')][_0x0065('0x13')]);}else{logger[_0x0065('0xe')](_0x0065('0x12'),_0x2afe89,_0x0065('0x14'));_0x49ef12(_0x2ba986[_0x0065('0x15')][_0x0065('0x13')]);}})[_0x0065('0x16')](function(_0x179f85){logger[_0x0065('0x11')]('UserProfile,\x20%s,\x20%s',_0x2afe89,_0x179f85);_0x535a92(_0x179f85);});});}