23fd4ef1f9ec373fed2e7f45aad03430d5ebde42
[motion2.git] / server / api / team / team.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 _0x85c7=['redis','defaults','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5b1370,_0x5beac4){var _0xf5075d=function(_0x26aeab){while(--_0x26aeab){_0x5b1370['push'](_0x5b1370['shift']());}};_0xf5075d(++_0x5beac4);}(_0x85c7,0x1d3));var _0x785c=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x85c7[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x785c('0x0'));var util=require(_0x785c('0x1'));var moment=require(_0x785c('0x2'));var BPromise=require(_0x785c('0x3'));var rs=require(_0x785c('0x4'));var fs=require('fs');var Redis=require(_0x785c('0x5'));var db=require(_0x785c('0x6'))['db'];var utils=require(_0x785c('0x7'));var logger=require(_0x785c('0x8'))(_0x785c('0x9'));var config=require('../../config/environment');var jayson=require(_0x785c('0xa'));var client=jayson[_0x785c('0xb')][_0x785c('0xc')]({'port':0x232a});config[_0x785c('0xd')]=_[_0x785c('0xe')](config[_0x785c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x785c('0xf'))(new Redis(config[_0x785c('0xd')]));require(_0x785c('0x10'))[_0x785c('0x11')](socket);function respondWithRpcPromise(_0x11ec3,_0x361ce8,_0x426491){return new BPromise(function(_0xb3cfe1,_0x45252c){return client[_0x785c('0x12')](_0x11ec3,_0x426491)[_0x785c('0x13')](function(_0x25b4d6){logger['info'](_0x785c('0x14'),_0x361ce8,_0x785c('0x15'));logger[_0x785c('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x361ce8,_0x785c('0x15'),JSON[_0x785c('0x17')](_0x25b4d6));if(_0x25b4d6['error']){if(_0x25b4d6[_0x785c('0x18')][_0x785c('0x19')]===0x1f4){logger[_0x785c('0x18')]('Team,\x20%s,\x20%s',_0x361ce8,_0x25b4d6[_0x785c('0x18')][_0x785c('0x1a')]);return _0x45252c(_0x25b4d6[_0x785c('0x18')][_0x785c('0x1a')]);}logger['error'](_0x785c('0x14'),_0x361ce8,_0x25b4d6[_0x785c('0x18')][_0x785c('0x1a')]);return _0xb3cfe1(_0x25b4d6[_0x785c('0x18')][_0x785c('0x1a')]);}else{logger[_0x785c('0x1b')]('Team,\x20%s,\x20%s',_0x361ce8,_0x785c('0x15'));_0xb3cfe1(_0x25b4d6[_0x785c('0x1c')][_0x785c('0x1a')]);}})[_0x785c('0x1d')](function(_0x5cc395){logger[_0x785c('0x18')]('Team,\x20%s,\x20%s',_0x361ce8,_0x5cc395);_0x45252c(_0x5cc395);});});}