Built motion from commit 0900f080.|2.5.45
[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 _0x97f9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x97f9,0x10d));var _0x997f=function(_0x203faa,_0x87a9f5){_0x203faa=_0x203faa-0x0;var _0x5cefad=_0x97f9[_0x203faa];return _0x5cefad;};'use strict';var _=require(_0x997f('0x0'));var util=require(_0x997f('0x1'));var moment=require(_0x997f('0x2'));var BPromise=require(_0x997f('0x3'));var rs=require(_0x997f('0x4'));var fs=require('fs');var Redis=require(_0x997f('0x5'));var db=require(_0x997f('0x6'))['db'];var utils=require(_0x997f('0x7'));var logger=require(_0x997f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x997f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x997f('0xa')],{'host':_0x997f('0xb'),'port':0x18eb});var socket=require(_0x997f('0xc'))(new Redis(config[_0x997f('0xa')]));require(_0x997f('0xd'))[_0x997f('0xe')](socket);function respondWithRpcPromise(_0x5ee419,_0x4231e8,_0x3499b0){return new BPromise(function(_0x271278,_0x169633){return client[_0x997f('0xf')](_0x5ee419,_0x3499b0)[_0x997f('0x10')](function(_0x1ba7f1){logger[_0x997f('0x11')](_0x997f('0x12'),_0x4231e8,_0x997f('0x13'));logger['debug'](_0x997f('0x14'),_0x4231e8,'request\x20sent',JSON[_0x997f('0x15')](_0x1ba7f1));if(_0x1ba7f1[_0x997f('0x16')]){if(_0x1ba7f1['error'][_0x997f('0x17')]===0x1f4){logger[_0x997f('0x16')](_0x997f('0x12'),_0x4231e8,_0x1ba7f1[_0x997f('0x16')][_0x997f('0x18')]);return _0x169633(_0x1ba7f1['error'][_0x997f('0x18')]);}logger[_0x997f('0x16')]('Team,\x20%s,\x20%s',_0x4231e8,_0x1ba7f1[_0x997f('0x16')]['message']);return _0x271278(_0x1ba7f1['error'][_0x997f('0x18')]);}else{logger[_0x997f('0x11')](_0x997f('0x12'),_0x4231e8,_0x997f('0x13'));_0x271278(_0x1ba7f1[_0x997f('0x19')][_0x997f('0x18')]);}})[_0x997f('0x1a')](function(_0x579f7a){logger['error'](_0x997f('0x12'),_0x4231e8,_0x579f7a);_0x169633(_0x579f7a);});});}