854024d05fd3a0da86c403ef8b85d64f289c904d
[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 _0x994d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x33445d,_0x4a2baf){var _0x48a9e8=function(_0x20b377){while(--_0x20b377){_0x33445d['push'](_0x33445d['shift']());}};_0x48a9e8(++_0x4a2baf);}(_0x994d,0x177));var _0xd994=function(_0x3e5768,_0x5967ac){_0x3e5768=_0x3e5768-0x0;var _0x18950e=_0x994d[_0x3e5768];return _0x18950e;};'use strict';var _=require(_0xd994('0x0'));var util=require('util');var moment=require(_0xd994('0x1'));var BPromise=require(_0xd994('0x2'));var rs=require(_0xd994('0x3'));var fs=require('fs');var Redis=require(_0xd994('0x4'));var db=require(_0xd994('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd994('0x6'))(_0xd994('0x7'));var config=require('../../config/environment');var jayson=require(_0xd994('0x8'));var client=jayson[_0xd994('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xd994('0xa')],{'host':_0xd994('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd994('0xa')]));require('./team.socket')[_0xd994('0xc')](socket);function respondWithRpcPromise(_0xbdee4a,_0x5ee6ac,_0x33e60e){return new BPromise(function(_0x318691,_0x52a580){return client[_0xd994('0xd')](_0xbdee4a,_0x33e60e)[_0xd994('0xe')](function(_0x5686d8){logger[_0xd994('0xf')](_0xd994('0x10'),_0x5ee6ac,_0xd994('0x11'));logger[_0xd994('0x12')](_0xd994('0x13'),_0x5ee6ac,_0xd994('0x11'),JSON[_0xd994('0x14')](_0x5686d8));if(_0x5686d8[_0xd994('0x15')]){if(_0x5686d8['error'][_0xd994('0x16')]===0x1f4){logger[_0xd994('0x15')](_0xd994('0x10'),_0x5ee6ac,_0x5686d8[_0xd994('0x15')][_0xd994('0x17')]);return _0x52a580(_0x5686d8[_0xd994('0x15')]['message']);}logger['error'](_0xd994('0x10'),_0x5ee6ac,_0x5686d8['error'][_0xd994('0x17')]);return _0x318691(_0x5686d8[_0xd994('0x15')]['message']);}else{logger['info'](_0xd994('0x10'),_0x5ee6ac,_0xd994('0x11'));_0x318691(_0x5686d8['result']['message']);}})[_0xd994('0x18')](function(_0x187c1d){logger[_0xd994('0x15')](_0xd994('0x10'),_0x5ee6ac,_0x187c1d);_0x52a580(_0x187c1d);});});}