Built motion from commit 639a1a7f.|2.6.19
[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 _0x8110=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','ioredis'];(function(_0x9d1cb4,_0x3dbed0){var _0x2ad7c7=function(_0x58ee59){while(--_0x58ee59){_0x9d1cb4['push'](_0x9d1cb4['shift']());}};_0x2ad7c7(++_0x3dbed0);}(_0x8110,0x185));var _0x0811=function(_0x533365,_0x2c31bb){_0x533365=_0x533365-0x0;var _0x3e8575=_0x8110[_0x533365];return _0x3e8575;};'use strict';var _=require('lodash');var util=require(_0x0811('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0811('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0811('0x2'));var logger=require(_0x0811('0x3'))(_0x0811('0x4'));var config=require(_0x0811('0x5'));var jayson=require(_0x0811('0x6'));var client=jayson['client'][_0x0811('0x7')]({'port':0x232a});config['redis']=_[_0x0811('0x8')](config[_0x0811('0x9')],{'host':_0x0811('0xa'),'port':0x18eb});var socket=require(_0x0811('0xb'))(new Redis(config[_0x0811('0x9')]));require(_0x0811('0xc'))[_0x0811('0xd')](socket);function respondWithRpcPromise(_0x297459,_0x2baaa3,_0x37e502){return new BPromise(function(_0x4aea9e,_0x521f2a){return client['request'](_0x297459,_0x37e502)[_0x0811('0xe')](function(_0x5122c6){logger['info'](_0x0811('0xf'),_0x2baaa3,'request\x20sent');logger[_0x0811('0x10')](_0x0811('0x11'),_0x2baaa3,_0x0811('0x12'),JSON[_0x0811('0x13')](_0x5122c6));if(_0x5122c6[_0x0811('0x14')]){if(_0x5122c6['error']['code']===0x1f4){logger[_0x0811('0x14')]('UserProfile,\x20%s,\x20%s',_0x2baaa3,_0x5122c6['error'][_0x0811('0x15')]);return _0x521f2a(_0x5122c6['error']['message']);}logger['error'](_0x0811('0xf'),_0x2baaa3,_0x5122c6[_0x0811('0x14')][_0x0811('0x15')]);return _0x4aea9e(_0x5122c6[_0x0811('0x14')][_0x0811('0x15')]);}else{logger['info'](_0x0811('0xf'),_0x2baaa3,_0x0811('0x12'));_0x4aea9e(_0x5122c6[_0x0811('0x16')][_0x0811('0x15')]);}})['catch'](function(_0x5f0a08){logger[_0x0811('0x14')](_0x0811('0xf'),_0x2baaa3,_0x5f0a08);_0x521f2a(_0x5f0a08);});});}