338e3fe5056a84d72cd94b5b9a064727840cc2bb
[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 _0xb770=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','UserProfileResource,\x20%s,\x20%s','message','info','result','util'];(function(_0x4d78fb,_0x280202){var _0x2898bf=function(_0x11ba3c){while(--_0x11ba3c){_0x4d78fb['push'](_0x4d78fb['shift']());}};_0x2898bf(++_0x280202);}(_0xb770,0x1e2));var _0x0b77=function(_0x6eb857,_0x573b1a){_0x6eb857=_0x6eb857-0x0;var _0x5c7aea=_0xb770[_0x6eb857];return _0x5c7aea;};'use strict';var _=require('lodash');var util=require(_0x0b77('0x0'));var moment=require(_0x0b77('0x1'));var BPromise=require(_0x0b77('0x2'));var rs=require(_0x0b77('0x3'));var fs=require('fs');var Redis=require(_0x0b77('0x4'));var db=require(_0x0b77('0x5'))['db'];var utils=require(_0x0b77('0x6'));var logger=require(_0x0b77('0x7'))(_0x0b77('0x8'));var config=require(_0x0b77('0x9'));var jayson=require(_0x0b77('0xa'));var client=jayson[_0x0b77('0xb')][_0x0b77('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55e9b6,_0x176698,_0x5bed15){return new BPromise(function(_0x1b802a,_0x32ff80){return client[_0x0b77('0xd')](_0x55e9b6,_0x5bed15)[_0x0b77('0xe')](function(_0x2bcb59){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x176698,_0x0b77('0xf'));logger[_0x0b77('0x10')](_0x0b77('0x11'),_0x176698,_0x0b77('0xf'),JSON['stringify'](_0x2bcb59));if(_0x2bcb59['error']){if(_0x2bcb59[_0x0b77('0x12')]['code']===0x1f4){logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x2bcb59[_0x0b77('0x12')][_0x0b77('0x14')]);return _0x32ff80(_0x2bcb59['error'][_0x0b77('0x14')]);}logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x2bcb59[_0x0b77('0x12')]['message']);return _0x1b802a(_0x2bcb59['error']['message']);}else{logger[_0x0b77('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x176698,_0x0b77('0xf'));_0x1b802a(_0x2bcb59[_0x0b77('0x16')][_0x0b77('0x14')]);}})['catch'](function(_0x4265e9){logger[_0x0b77('0x12')](_0x0b77('0x13'),_0x176698,_0x4265e9);_0x32ff80(_0x4265e9);});});}