5e6b44b2b06433b36963b5a8697efe5d2d86537d
[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 _0xac22=['info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x17a28b,_0x5d1465){var _0x9cbb5a=function(_0x24e3c9){while(--_0x24e3c9){_0x17a28b['push'](_0x17a28b['shift']());}};_0x9cbb5a(++_0x5d1465);}(_0xac22,0x16b));var _0x2ac2=function(_0x1a4e27,_0x794d2c){_0x1a4e27=_0x1a4e27-0x0;var _0xbde21=_0xac22[_0x1a4e27];return _0xbde21;};'use strict';var _=require(_0x2ac2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ac2('0x1'));var rs=require(_0x2ac2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ac2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ac2('0x4'))(_0x2ac2('0x5'));var config=require(_0x2ac2('0x6'));var jayson=require(_0x2ac2('0x7'));var client=jayson[_0x2ac2('0x8')][_0x2ac2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f2bdc,_0x3a97ba,_0x3bcf1a){return new BPromise(function(_0x33290b,_0x386ea4){return client[_0x2ac2('0xa')](_0x2f2bdc,_0x3bcf1a)['then'](function(_0x2930ca){logger[_0x2ac2('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x3a97ba,_0x2ac2('0xc'));logger[_0x2ac2('0xd')](_0x2ac2('0xe'),_0x3a97ba,_0x2ac2('0xc'),JSON[_0x2ac2('0xf')](_0x2930ca));if(_0x2930ca[_0x2ac2('0x10')]){if(_0x2930ca['error'][_0x2ac2('0x11')]===0x1f4){logger[_0x2ac2('0x10')](_0x2ac2('0x12'),_0x3a97ba,_0x2930ca[_0x2ac2('0x10')]['message']);return _0x386ea4(_0x2930ca[_0x2ac2('0x10')][_0x2ac2('0x13')]);}logger['error'](_0x2ac2('0x12'),_0x3a97ba,_0x2930ca[_0x2ac2('0x10')]['message']);return _0x33290b(_0x2930ca[_0x2ac2('0x10')][_0x2ac2('0x13')]);}else{logger[_0x2ac2('0xb')](_0x2ac2('0x12'),_0x3a97ba,_0x2ac2('0xc'));_0x33290b(_0x2930ca[_0x2ac2('0x14')][_0x2ac2('0x13')]);}})[_0x2ac2('0x15')](function(_0x2b1ea6){logger[_0x2ac2('0x10')](_0x2ac2('0x12'),_0x3a97ba,_0x2b1ea6);_0x386ea4(_0x2b1ea6);});});}