e9ae3e1cc090a53d1a8d13278f8148050200c11f
[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 _0xf188=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54d6a5,_0x33861c){var _0x13e945=function(_0x488fda){while(--_0x488fda){_0x54d6a5['push'](_0x54d6a5['shift']());}};_0x13e945(++_0x33861c);}(_0xf188,0x1b5));var _0x8f18=function(_0x3b9b9a,_0xad54d1){_0x3b9b9a=_0x3b9b9a-0x0;var _0x5ab926=_0xf188[_0x3b9b9a];return _0x5ab926;};'use strict';var _=require(_0x8f18('0x0'));var util=require(_0x8f18('0x1'));var moment=require(_0x8f18('0x2'));var BPromise=require(_0x8f18('0x3'));var rs=require(_0x8f18('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8f18('0x5'));var jayson=require(_0x8f18('0x6'));var client=jayson[_0x8f18('0x7')]['http']({'port':0x232a});config[_0x8f18('0x8')]=_[_0x8f18('0x9')](config[_0x8f18('0x8')],{'host':_0x8f18('0xa'),'port':0x18eb});var socket=require(_0x8f18('0xb'))(new Redis(config['redis']));require(_0x8f18('0xc'))['register'](socket);function respondWithRpcPromise(_0x8964db,_0x1869f5,_0x36b7a7){return new BPromise(function(_0x519cea,_0x3f1325){return client['request'](_0x8964db,_0x36b7a7)[_0x8f18('0xd')](function(_0x50b373){logger[_0x8f18('0xe')](_0x8f18('0xf'),_0x1869f5,_0x8f18('0x10'));logger['debug'](_0x8f18('0x11'),_0x1869f5,_0x8f18('0x10'),JSON[_0x8f18('0x12')](_0x50b373));if(_0x50b373['error']){if(_0x50b373[_0x8f18('0x13')][_0x8f18('0x14')]===0x1f4){logger['error'](_0x8f18('0xf'),_0x1869f5,_0x50b373[_0x8f18('0x13')][_0x8f18('0x15')]);return _0x3f1325(_0x50b373[_0x8f18('0x13')]['message']);}logger[_0x8f18('0x13')](_0x8f18('0xf'),_0x1869f5,_0x50b373[_0x8f18('0x13')][_0x8f18('0x15')]);return _0x519cea(_0x50b373[_0x8f18('0x13')][_0x8f18('0x15')]);}else{logger[_0x8f18('0xe')](_0x8f18('0xf'),_0x1869f5,_0x8f18('0x10'));_0x519cea(_0x50b373[_0x8f18('0x16')][_0x8f18('0x15')]);}})[_0x8f18('0x17')](function(_0x3efa57){logger[_0x8f18('0x13')](_0x8f18('0xf'),_0x1869f5,_0x3efa57);_0x3f1325(_0x3efa57);});});}