6b3eeb18b1cb2443cd9fca45c647587356ce4f83
[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 _0x709a=['UserProfileResource,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','stringify','error','code'];(function(_0x2b4a1b,_0x330f0d){var _0x94b62d=function(_0x41e625){while(--_0x41e625){_0x2b4a1b['push'](_0x2b4a1b['shift']());}};_0x94b62d(++_0x330f0d);}(_0x709a,0x1d0));var _0xa709=function(_0x19cfae,_0x5966ff){_0x19cfae=_0x19cfae-0x0;var _0x3d332d=_0x709a[_0x19cfae];return _0x3d332d;};'use strict';var _=require('lodash');var util=require(_0xa709('0x0'));var moment=require(_0xa709('0x1'));var BPromise=require(_0xa709('0x2'));var rs=require(_0xa709('0x3'));var fs=require('fs');var Redis=require(_0xa709('0x4'));var db=require(_0xa709('0x5'))['db'];var utils=require(_0xa709('0x6'));var logger=require(_0xa709('0x7'))(_0xa709('0x8'));var config=require('../../config/environment');var jayson=require(_0xa709('0x9'));var client=jayson[_0xa709('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x121cf7,_0x271c53,_0x2d4a76){return new BPromise(function(_0x126845,_0xeef823){return client['request'](_0x121cf7,_0x2d4a76)[_0xa709('0xb')](function(_0x27a0d5){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x271c53,_0xa709('0xc'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x271c53,_0xa709('0xc'),JSON[_0xa709('0xd')](_0x27a0d5));if(_0x27a0d5[_0xa709('0xe')]){if(_0x27a0d5['error'][_0xa709('0xf')]===0x1f4){logger['error'](_0xa709('0x10'),_0x271c53,_0x27a0d5['error'][_0xa709('0x11')]);return _0xeef823(_0x27a0d5[_0xa709('0xe')][_0xa709('0x11')]);}logger[_0xa709('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x271c53,_0x27a0d5[_0xa709('0xe')]['message']);return _0x126845(_0x27a0d5[_0xa709('0xe')][_0xa709('0x11')]);}else{logger['info'](_0xa709('0x10'),_0x271c53,_0xa709('0xc'));_0x126845(_0x27a0d5[_0xa709('0x12')][_0xa709('0x11')]);}})[_0xa709('0x13')](function(_0x54657b){logger[_0xa709('0xe')](_0xa709('0x10'),_0x271c53,_0x54657b);_0xeef823(_0x54657b);});});}