120da24034a6dae38628f4d7dc92e4bf9f019292
[motion2.git] / server / api / userProfileResource / userProfileResource.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 _0x14ff=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x18a93f,_0x529fe1){var _0x364d7a=function(_0x1b1763){while(--_0x1b1763){_0x18a93f['push'](_0x18a93f['shift']());}};_0x364d7a(++_0x529fe1);}(_0x14ff,0x88));var _0xf14f=function(_0x5f5a2f,_0x572f75){_0x5f5a2f=_0x5f5a2f-0x0;var _0x439e50=_0x14ff[_0x5f5a2f];return _0x439e50;};'use strict';var _=require(_0xf14f('0x0'));var util=require(_0xf14f('0x1'));var moment=require(_0xf14f('0x2'));var BPromise=require(_0xf14f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf14f('0x4'));var db=require(_0xf14f('0x5'))['db'];var utils=require(_0xf14f('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf14f('0x7'));var client=jayson[_0xf14f('0x8')][_0xf14f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x457110,_0x447681,_0x2d1c4e){return new BPromise(function(_0x12cc2a,_0x576294){return client[_0xf14f('0xa')](_0x457110,_0x2d1c4e)[_0xf14f('0xb')](function(_0x4727a2){logger[_0xf14f('0xc')](_0xf14f('0xd'),_0x447681,_0xf14f('0xe'));logger[_0xf14f('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x447681,'request\x20sent',JSON[_0xf14f('0x10')](_0x4727a2));if(_0x4727a2[_0xf14f('0x11')]){if(_0x4727a2[_0xf14f('0x11')][_0xf14f('0x12')]===0x1f4){logger[_0xf14f('0x11')](_0xf14f('0xd'),_0x447681,_0x4727a2[_0xf14f('0x11')][_0xf14f('0x13')]);return _0x576294(_0x4727a2[_0xf14f('0x11')]['message']);}logger[_0xf14f('0x11')](_0xf14f('0xd'),_0x447681,_0x4727a2[_0xf14f('0x11')][_0xf14f('0x13')]);return _0x12cc2a(_0x4727a2['error'][_0xf14f('0x13')]);}else{logger[_0xf14f('0xc')](_0xf14f('0xd'),_0x447681,_0xf14f('0xe'));_0x12cc2a(_0x4727a2['result']['message']);}})['catch'](function(_0x42b11d){logger[_0xf14f('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x447681,_0x42b11d);_0x576294(_0x42b11d);});});}