a989a8cf2d8fc4b35bf35b1d30e8f41e5954dcba
[motion2.git] / server / api / userProfileSection / userProfileSection.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 _0x1d99=['client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d99,0x16f));var _0x91d9=function(_0x4b6013,_0x10b975){_0x4b6013=_0x4b6013-0x0;var _0x1a6be3=_0x1d99[_0x4b6013];return _0x1a6be3;};'use strict';var _=require('lodash');var util=require(_0x91d9('0x0'));var moment=require(_0x91d9('0x1'));var BPromise=require(_0x91d9('0x2'));var rs=require(_0x91d9('0x3'));var fs=require('fs');var Redis=require(_0x91d9('0x4'));var db=require(_0x91d9('0x5'))['db'];var utils=require(_0x91d9('0x6'));var logger=require(_0x91d9('0x7'))(_0x91d9('0x8'));var config=require(_0x91d9('0x9'));var jayson=require(_0x91d9('0xa'));var client=jayson[_0x91d9('0xb')][_0x91d9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x130fc7,_0x20400d,_0xf37bf2){return new BPromise(function(_0x3d5551,_0x230d0f){return client['request'](_0x130fc7,_0xf37bf2)[_0x91d9('0xd')](function(_0x21e58c){logger['info'](_0x91d9('0xe'),_0x20400d,_0x91d9('0xf'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x20400d,_0x91d9('0xf'),JSON['stringify'](_0x21e58c));if(_0x21e58c['error']){if(_0x21e58c[_0x91d9('0x10')]['code']===0x1f4){logger[_0x91d9('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x20400d,_0x21e58c[_0x91d9('0x10')][_0x91d9('0x11')]);return _0x230d0f(_0x21e58c[_0x91d9('0x10')][_0x91d9('0x11')]);}logger[_0x91d9('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x20400d,_0x21e58c[_0x91d9('0x10')][_0x91d9('0x11')]);return _0x3d5551(_0x21e58c[_0x91d9('0x10')][_0x91d9('0x11')]);}else{logger[_0x91d9('0x12')](_0x91d9('0xe'),_0x20400d,_0x91d9('0xf'));_0x3d5551(_0x21e58c[_0x91d9('0x13')]['message']);}})[_0x91d9('0x14')](function(_0x23300e){logger[_0x91d9('0x10')](_0x91d9('0xe'),_0x20400d,_0x23300e);_0x230d0f(_0x23300e);});});}