276a32f6a319cbdbc5c46c423a0b944ef8ad0957
[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 _0xb9fe=['then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','register','request'];(function(_0x1a0774,_0xa03762){var _0x1b3d8b=function(_0x48113d){while(--_0x48113d){_0x1a0774['push'](_0x1a0774['shift']());}};_0x1b3d8b(++_0xa03762);}(_0xb9fe,0xb9));var _0xeb9f=function(_0x577fbc,_0x34ce19){_0x577fbc=_0x577fbc-0x0;var _0x128708=_0xb9fe[_0x577fbc];return _0x128708;};'use strict';var _=require(_0xeb9f('0x0'));var util=require(_0xeb9f('0x1'));var moment=require(_0xeb9f('0x2'));var BPromise=require(_0xeb9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb9f('0x5'))(_0xeb9f('0x6'));var config=require(_0xeb9f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb9f('0x8')][_0xeb9f('0x9')]({'port':0x232a});config['redis']=_[_0xeb9f('0xa')](config[_0xeb9f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb9f('0xc'))(new Redis(config[_0xeb9f('0xb')]));require('./team.socket')[_0xeb9f('0xd')](socket);function respondWithRpcPromise(_0xe0715b,_0x37b99d,_0x3794b3){return new BPromise(function(_0x3ed5b7,_0x59e4f4){return client[_0xeb9f('0xe')](_0xe0715b,_0x3794b3)[_0xeb9f('0xf')](function(_0x5e021f){logger[_0xeb9f('0x10')](_0xeb9f('0x11'),_0x37b99d,'request\x20sent');logger[_0xeb9f('0x12')](_0xeb9f('0x13'),_0x37b99d,_0xeb9f('0x14'),JSON['stringify'](_0x5e021f));if(_0x5e021f[_0xeb9f('0x15')]){if(_0x5e021f['error'][_0xeb9f('0x16')]===0x1f4){logger[_0xeb9f('0x15')]('Team,\x20%s,\x20%s',_0x37b99d,_0x5e021f[_0xeb9f('0x15')][_0xeb9f('0x17')]);return _0x59e4f4(_0x5e021f[_0xeb9f('0x15')][_0xeb9f('0x17')]);}logger[_0xeb9f('0x15')](_0xeb9f('0x11'),_0x37b99d,_0x5e021f[_0xeb9f('0x15')][_0xeb9f('0x17')]);return _0x3ed5b7(_0x5e021f[_0xeb9f('0x15')][_0xeb9f('0x17')]);}else{logger[_0xeb9f('0x10')]('Team,\x20%s,\x20%s',_0x37b99d,_0xeb9f('0x14'));_0x3ed5b7(_0x5e021f[_0xeb9f('0x18')][_0xeb9f('0x17')]);}})['catch'](function(_0xc22fc8){logger[_0xeb9f('0x15')](_0xeb9f('0x11'),_0x37b99d,_0xc22fc8);_0x59e4f4(_0xc22fc8);});});}