Built motion from commit 00bf23f6.|2.6.16
[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 _0xbfe2=['info','Team,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request'];(function(_0x5c6be5,_0x3ff1d5){var _0x151348=function(_0x3df6c6){while(--_0x3df6c6){_0x5c6be5['push'](_0x5c6be5['shift']());}};_0x151348(++_0x3ff1d5);}(_0xbfe2,0x75));var _0x2bfe=function(_0x693f3a,_0x3dce46){_0x693f3a=_0x693f3a-0x0;var _0x3225d0=_0xbfe2[_0x693f3a];return _0x3225d0;};'use strict';var _=require(_0x2bfe('0x0'));var util=require(_0x2bfe('0x1'));var moment=require('moment');var BPromise=require(_0x2bfe('0x2'));var rs=require(_0x2bfe('0x3'));var fs=require('fs');var Redis=require(_0x2bfe('0x4'));var db=require(_0x2bfe('0x5'))['db'];var utils=require(_0x2bfe('0x6'));var logger=require(_0x2bfe('0x7'))('rpc');var config=require(_0x2bfe('0x8'));var jayson=require(_0x2bfe('0x9'));var client=jayson[_0x2bfe('0xa')][_0x2bfe('0xb')]({'port':0x232a});config['redis']=_[_0x2bfe('0xc')](config['redis'],{'host':_0x2bfe('0xd'),'port':0x18eb});var socket=require(_0x2bfe('0xe'))(new Redis(config[_0x2bfe('0xf')]));require('./team.socket')[_0x2bfe('0x10')](socket);function respondWithRpcPromise(_0x3f2a8c,_0x28ec35,_0x546f8a){return new BPromise(function(_0x25f0e0,_0x2dd935){return client[_0x2bfe('0x11')](_0x3f2a8c,_0x546f8a)['then'](function(_0x369bf6){logger[_0x2bfe('0x12')](_0x2bfe('0x13'),_0x28ec35,_0x2bfe('0x14'));logger[_0x2bfe('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x28ec35,_0x2bfe('0x14'),JSON['stringify'](_0x369bf6));if(_0x369bf6[_0x2bfe('0x16')]){if(_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x17')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x28ec35,_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x18')]);return _0x2dd935(_0x369bf6['error'][_0x2bfe('0x18')]);}logger['error'](_0x2bfe('0x13'),_0x28ec35,_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x18')]);return _0x25f0e0(_0x369bf6[_0x2bfe('0x16')][_0x2bfe('0x18')]);}else{logger[_0x2bfe('0x12')](_0x2bfe('0x13'),_0x28ec35,_0x2bfe('0x14'));_0x25f0e0(_0x369bf6[_0x2bfe('0x19')]['message']);}})[_0x2bfe('0x1a')](function(_0x52134e){logger[_0x2bfe('0x16')](_0x2bfe('0x13'),_0x28ec35,_0x52134e);_0x2dd935(_0x52134e);});});}