ed0bfe249bc0b66004108354e61ed70ac8ce6aea
[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 _0xf40f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./team.socket','register','then','Team,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch'];(function(_0x11fe67,_0x3cbc74){var _0x1de450=function(_0x334e04){while(--_0x334e04){_0x11fe67['push'](_0x11fe67['shift']());}};_0x1de450(++_0x3cbc74);}(_0xf40f,0x129));var _0xff40=function(_0x40005d,_0x2a47bf){_0x40005d=_0x40005d-0x0;var _0x106958=_0xf40f[_0x40005d];return _0x106958;};'use strict';var _=require(_0xff40('0x0'));var util=require(_0xff40('0x1'));var moment=require(_0xff40('0x2'));var BPromise=require(_0xff40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff40('0x4'));var db=require(_0xff40('0x5'))['db'];var utils=require(_0xff40('0x6'));var logger=require(_0xff40('0x7'))(_0xff40('0x8'));var config=require(_0xff40('0x9'));var jayson=require(_0xff40('0xa'));var client=jayson[_0xff40('0xb')]['http']({'port':0x232a});config[_0xff40('0xc')]=_[_0xff40('0xd')](config[_0xff40('0xc')],{'host':_0xff40('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xff40('0xc')]));require(_0xff40('0xf'))[_0xff40('0x10')](socket);function respondWithRpcPromise(_0x221d18,_0x217f30,_0x92cec5){return new BPromise(function(_0x1a53fc,_0x244af2){return client['request'](_0x221d18,_0x92cec5)[_0xff40('0x11')](function(_0x7d1644){logger['info'](_0xff40('0x12'),_0x217f30,_0xff40('0x13'));logger[_0xff40('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x217f30,'request\x20sent',JSON['stringify'](_0x7d1644));if(_0x7d1644[_0xff40('0x15')]){if(_0x7d1644['error'][_0xff40('0x16')]===0x1f4){logger[_0xff40('0x15')]('Team,\x20%s,\x20%s',_0x217f30,_0x7d1644[_0xff40('0x15')][_0xff40('0x17')]);return _0x244af2(_0x7d1644[_0xff40('0x15')][_0xff40('0x17')]);}logger[_0xff40('0x15')]('Team,\x20%s,\x20%s',_0x217f30,_0x7d1644['error'][_0xff40('0x17')]);return _0x1a53fc(_0x7d1644['error']['message']);}else{logger[_0xff40('0x18')](_0xff40('0x12'),_0x217f30,_0xff40('0x13'));_0x1a53fc(_0x7d1644[_0xff40('0x19')]['message']);}})[_0xff40('0x1a')](function(_0x18602b){logger[_0xff40('0x15')]('Team,\x20%s,\x20%s',_0x217f30,_0x18602b);_0x244af2(_0x18602b);});});}