Built motion from commit eddce310.|2.6.12
[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 _0xc7bd=['redis','localhost','socket.io-emitter','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x47d2b0,_0x2df54d){var _0x332f8a=function(_0xbb960f){while(--_0xbb960f){_0x47d2b0['push'](_0x47d2b0['shift']());}};_0x332f8a(++_0x2df54d);}(_0xc7bd,0x86));var _0xdc7b=function(_0x2a6e62,_0xa82f7d){_0x2a6e62=_0x2a6e62-0x0;var _0x2e0cf9=_0xc7bd[_0x2a6e62];return _0x2e0cf9;};'use strict';var _=require('lodash');var util=require(_0xdc7b('0x0'));var moment=require(_0xdc7b('0x1'));var BPromise=require('bluebird');var rs=require(_0xdc7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc7b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc7b('0x4'))(_0xdc7b('0x5'));var config=require(_0xdc7b('0x6'));var jayson=require(_0xdc7b('0x7'));var client=jayson[_0xdc7b('0x8')][_0xdc7b('0x9')]({'port':0x232a});config[_0xdc7b('0xa')]=_['defaults'](config[_0xdc7b('0xa')],{'host':_0xdc7b('0xb'),'port':0x18eb});var socket=require(_0xdc7b('0xc'))(new Redis(config['redis']));require('./userProfile.socket')[_0xdc7b('0xd')](socket);function respondWithRpcPromise(_0x316a19,_0x167e40,_0x295800){return new BPromise(function(_0xec8041,_0x44d499){return client['request'](_0x316a19,_0x295800)[_0xdc7b('0xe')](function(_0x359a53){logger[_0xdc7b('0xf')](_0xdc7b('0x10'),_0x167e40,_0xdc7b('0x11'));logger[_0xdc7b('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x167e40,_0xdc7b('0x11'),JSON[_0xdc7b('0x13')](_0x359a53));if(_0x359a53['error']){if(_0x359a53[_0xdc7b('0x14')]['code']===0x1f4){logger[_0xdc7b('0x14')](_0xdc7b('0x10'),_0x167e40,_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);return _0x44d499(_0x359a53['error'][_0xdc7b('0x15')]);}logger[_0xdc7b('0x14')]('UserProfile,\x20%s,\x20%s',_0x167e40,_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);return _0xec8041(_0x359a53[_0xdc7b('0x14')][_0xdc7b('0x15')]);}else{logger[_0xdc7b('0xf')](_0xdc7b('0x10'),_0x167e40,_0xdc7b('0x11'));_0xec8041(_0x359a53[_0xdc7b('0x16')]['message']);}})[_0xdc7b('0x17')](function(_0x54a99b){logger[_0xdc7b('0x14')]('UserProfile,\x20%s,\x20%s',_0x167e40,_0x54a99b);_0x44d499(_0x54a99b);});});}