Built motion from commit b5413ace.|2.6.9
[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 _0x615b=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x237052,_0x28636d){var _0x627e37=function(_0x4686c9){while(--_0x4686c9){_0x237052['push'](_0x237052['shift']());}};_0x627e37(++_0x28636d);}(_0x615b,0x91));var _0xb615=function(_0x45f890,_0x4baefe){_0x45f890=_0x45f890-0x0;var _0x39b8f5=_0x615b[_0x45f890];return _0x39b8f5;};'use strict';var _=require('lodash');var util=require(_0xb615('0x0'));var moment=require(_0xb615('0x1'));var BPromise=require(_0xb615('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb615('0x3'));var db=require(_0xb615('0x4'))['db'];var utils=require(_0xb615('0x5'));var logger=require(_0xb615('0x6'))(_0xb615('0x7'));var config=require(_0xb615('0x8'));var jayson=require(_0xb615('0x9'));var client=jayson[_0xb615('0xa')][_0xb615('0xb')]({'port':0x232a});config[_0xb615('0xc')]=_[_0xb615('0xd')](config['redis'],{'host':_0xb615('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb615('0xc')]));require(_0xb615('0xf'))[_0xb615('0x10')](socket);function respondWithRpcPromise(_0x48f10a,_0x507cda,_0x2894a4){return new BPromise(function(_0x39a3cc,_0x4a4064){return client['request'](_0x48f10a,_0x2894a4)[_0xb615('0x11')](function(_0x5bb0c8){logger[_0xb615('0x12')](_0xb615('0x13'),_0x507cda,_0xb615('0x14'));logger[_0xb615('0x15')](_0xb615('0x16'),_0x507cda,_0xb615('0x14'),JSON['stringify'](_0x5bb0c8));if(_0x5bb0c8['error']){if(_0x5bb0c8[_0xb615('0x17')][_0xb615('0x18')]===0x1f4){logger[_0xb615('0x17')]('Team,\x20%s,\x20%s',_0x507cda,_0x5bb0c8['error'][_0xb615('0x19')]);return _0x4a4064(_0x5bb0c8[_0xb615('0x17')]['message']);}logger[_0xb615('0x17')](_0xb615('0x13'),_0x507cda,_0x5bb0c8[_0xb615('0x17')][_0xb615('0x19')]);return _0x39a3cc(_0x5bb0c8[_0xb615('0x17')][_0xb615('0x19')]);}else{logger['info'](_0xb615('0x13'),_0x507cda,'request\x20sent');_0x39a3cc(_0x5bb0c8[_0xb615('0x1a')][_0xb615('0x19')]);}})[_0xb615('0x1b')](function(_0xceb65d){logger[_0xb615('0x17')]('Team,\x20%s,\x20%s',_0x507cda,_0xceb65d);_0x4a4064(_0xceb65d);});});}