Built motion from commit 3d6333b4.|2.6.31
[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 _0x08f1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0xa6914a,_0x49a74f){var _0x41eb01=function(_0xbc6979){while(--_0xbc6979){_0xa6914a['push'](_0xa6914a['shift']());}};_0x41eb01(++_0x49a74f);}(_0x08f1,0x1d9));var _0x108f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x08f1[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x108f('0x0'));var util=require(_0x108f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x108f('0x2'))['db'];var utils=require(_0x108f('0x3'));var logger=require(_0x108f('0x4'))(_0x108f('0x5'));var config=require(_0x108f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x108f('0x7')][_0x108f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a28cf,_0xca5f45,_0x52b3bc){return new BPromise(function(_0x194c28,_0x69638d){return client['request'](_0x4a28cf,_0x52b3bc)[_0x108f('0x9')](function(_0x5c75aa){logger[_0x108f('0xa')]('UserProfileResource,\x20%s,\x20%s',_0xca5f45,_0x108f('0xb'));logger[_0x108f('0xc')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xca5f45,_0x108f('0xb'),JSON[_0x108f('0xd')](_0x5c75aa));if(_0x5c75aa['error']){if(_0x5c75aa[_0x108f('0xe')][_0x108f('0xf')]===0x1f4){logger[_0x108f('0xe')](_0x108f('0x10'),_0xca5f45,_0x5c75aa[_0x108f('0xe')][_0x108f('0x11')]);return _0x69638d(_0x5c75aa[_0x108f('0xe')][_0x108f('0x11')]);}logger['error'](_0x108f('0x10'),_0xca5f45,_0x5c75aa[_0x108f('0xe')][_0x108f('0x11')]);return _0x194c28(_0x5c75aa[_0x108f('0xe')]['message']);}else{logger[_0x108f('0xa')](_0x108f('0x10'),_0xca5f45,'request\x20sent');_0x194c28(_0x5c75aa['result'][_0x108f('0x11')]);}})[_0x108f('0x12')](function(_0x54ca61){logger[_0x108f('0xe')](_0x108f('0x10'),_0xca5f45,_0x54ca61);_0x69638d(_0x54ca61);});});}