bc198a0aa459b2e6d0f4bf6e3c86e2fdf6743323
[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 _0x88a2=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x88a2,0x9d));var _0x288a=function(_0x310463,_0x7e69a1){_0x310463=_0x310463-0x0;var _0x32f582=_0x88a2[_0x310463];return _0x32f582;};'use strict';var _=require('lodash');var util=require(_0x288a('0x0'));var moment=require('moment');var BPromise=require(_0x288a('0x1'));var rs=require(_0x288a('0x2'));var fs=require('fs');var Redis=require(_0x288a('0x3'));var db=require(_0x288a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x288a('0x5'));var config=require(_0x288a('0x6'));var jayson=require(_0x288a('0x7'));var client=jayson[_0x288a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40dc91,_0x85d235,_0x3ca42f){return new BPromise(function(_0x334e4c,_0x3e5fa2){return client[_0x288a('0x9')](_0x40dc91,_0x3ca42f)[_0x288a('0xa')](function(_0x6730e1){logger[_0x288a('0xb')](_0x288a('0xc'),_0x85d235,_0x288a('0xd'));logger[_0x288a('0xe')](_0x288a('0xf'),_0x85d235,'request\x20sent',JSON['stringify'](_0x6730e1));if(_0x6730e1[_0x288a('0x10')]){if(_0x6730e1[_0x288a('0x10')]['code']===0x1f4){logger['error'](_0x288a('0xc'),_0x85d235,_0x6730e1['error'][_0x288a('0x11')]);return _0x3e5fa2(_0x6730e1[_0x288a('0x10')][_0x288a('0x11')]);}logger[_0x288a('0x10')](_0x288a('0xc'),_0x85d235,_0x6730e1[_0x288a('0x10')][_0x288a('0x11')]);return _0x334e4c(_0x6730e1[_0x288a('0x10')][_0x288a('0x11')]);}else{logger[_0x288a('0xb')](_0x288a('0xc'),_0x85d235,_0x288a('0xd'));_0x334e4c(_0x6730e1[_0x288a('0x12')]['message']);}})[_0x288a('0x13')](function(_0x2094ba){logger['error'](_0x288a('0xc'),_0x85d235,_0x2094ba);_0x3e5fa2(_0x2094ba);});});}