Built motion from commit 936e8062.|2.5.33
[motion2.git] / server / api / userProfile / userProfile.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 _0x5d59=['defaults','socket.io-emitter','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','redis'];(function(_0x5c9bb1,_0x8b7980){var _0x2c68f=function(_0x5bb5fc){while(--_0x5bb5fc){_0x5c9bb1['push'](_0x5c9bb1['shift']());}};_0x2c68f(++_0x8b7980);}(_0x5d59,0x15f));var _0x95d5=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0x5d59[_0x417774];return _0x10015d;};'use strict';var _=require('lodash');var util=require(_0x95d5('0x0'));var moment=require(_0x95d5('0x1'));var BPromise=require(_0x95d5('0x2'));var rs=require(_0x95d5('0x3'));var fs=require('fs');var Redis=require(_0x95d5('0x4'));var db=require(_0x95d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95d5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95d5('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x95d5('0x8')]=_[_0x95d5('0x9')](config[_0x95d5('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x95d5('0xa'))(new Redis(config['redis']));require(_0x95d5('0xb'))['register'](socket);function respondWithRpcPromise(_0x1d7963,_0x7ab3e5,_0x3a9f4e){return new BPromise(function(_0x406bbc,_0x1a4cf5){return client[_0x95d5('0xc')](_0x1d7963,_0x3a9f4e)[_0x95d5('0xd')](function(_0x1a9bba){logger['info'](_0x95d5('0xe'),_0x7ab3e5,'request\x20sent');logger['debug'](_0x95d5('0xf'),_0x7ab3e5,_0x95d5('0x10'),JSON[_0x95d5('0x11')](_0x1a9bba));if(_0x1a9bba[_0x95d5('0x12')]){if(_0x1a9bba['error'][_0x95d5('0x13')]===0x1f4){logger[_0x95d5('0x12')](_0x95d5('0xe'),_0x7ab3e5,_0x1a9bba[_0x95d5('0x12')][_0x95d5('0x14')]);return _0x1a4cf5(_0x1a9bba[_0x95d5('0x12')][_0x95d5('0x14')]);}logger[_0x95d5('0x12')](_0x95d5('0xe'),_0x7ab3e5,_0x1a9bba['error']['message']);return _0x406bbc(_0x1a9bba[_0x95d5('0x12')]['message']);}else{logger[_0x95d5('0x15')](_0x95d5('0xe'),_0x7ab3e5,'request\x20sent');_0x406bbc(_0x1a9bba[_0x95d5('0x16')][_0x95d5('0x14')]);}})[_0x95d5('0x17')](function(_0x350dbd){logger[_0x95d5('0x12')](_0x95d5('0xe'),_0x7ab3e5,_0x350dbd);_0x1a4cf5(_0x350dbd);});});}