Built motion from commit e6806ed6.|2.6.0
[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 _0x19ff=['localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x19ff,0xbc));var _0xf19f=function(_0x92f4ce,_0x44bf22){_0x92f4ce=_0x92f4ce-0x0;var _0x598a28=_0x19ff[_0x92f4ce];return _0x598a28;};'use strict';var _=require(_0xf19f('0x0'));var util=require(_0xf19f('0x1'));var moment=require(_0xf19f('0x2'));var BPromise=require(_0xf19f('0x3'));var rs=require(_0xf19f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf19f('0x5'));var logger=require('../../config/logger')(_0xf19f('0x6'));var config=require(_0xf19f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf19f('0x8')][_0xf19f('0x9')]({'port':0x232a});config[_0xf19f('0xa')]=_[_0xf19f('0xb')](config[_0xf19f('0xa')],{'host':_0xf19f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf19f('0xa')]));require(_0xf19f('0xd'))['register'](socket);function respondWithRpcPromise(_0x1e6ba6,_0x1ccbde,_0xc869f6){return new BPromise(function(_0x331c2c,_0x5b947a){return client[_0xf19f('0xe')](_0x1e6ba6,_0xc869f6)[_0xf19f('0xf')](function(_0x4b4611){logger[_0xf19f('0x10')](_0xf19f('0x11'),_0x1ccbde,_0xf19f('0x12'));logger[_0xf19f('0x13')](_0xf19f('0x14'),_0x1ccbde,_0xf19f('0x12'),JSON['stringify'](_0x4b4611));if(_0x4b4611[_0xf19f('0x15')]){if(_0x4b4611[_0xf19f('0x15')]['code']===0x1f4){logger['error'](_0xf19f('0x11'),_0x1ccbde,_0x4b4611[_0xf19f('0x15')][_0xf19f('0x16')]);return _0x5b947a(_0x4b4611[_0xf19f('0x15')][_0xf19f('0x16')]);}logger[_0xf19f('0x15')](_0xf19f('0x11'),_0x1ccbde,_0x4b4611['error'][_0xf19f('0x16')]);return _0x331c2c(_0x4b4611[_0xf19f('0x15')][_0xf19f('0x16')]);}else{logger[_0xf19f('0x10')]('Team,\x20%s,\x20%s',_0x1ccbde,_0xf19f('0x12'));_0x331c2c(_0x4b4611[_0xf19f('0x17')][_0xf19f('0x16')]);}})[_0xf19f('0x18')](function(_0x102703){logger[_0xf19f('0x15')](_0xf19f('0x11'),_0x1ccbde,_0x102703);_0x5b947a(_0x102703);});});}