01ca79171e38877f3caa83d0286bd25ea01973fc
[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 _0xda3d=['message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s'];(function(_0x899bfc,_0x10b5c4){var _0x363ad1=function(_0x3c6bfd){while(--_0x3c6bfd){_0x899bfc['push'](_0x899bfc['shift']());}};_0x363ad1(++_0x10b5c4);}(_0xda3d,0xac));var _0xdda3=function(_0x1576da,_0x5b99d4){_0x1576da=_0x1576da-0x0;var _0x4620de=_0xda3d[_0x1576da];return _0x4620de;};'use strict';var _=require(_0xdda3('0x0'));var util=require(_0xdda3('0x1'));var moment=require('moment');var BPromise=require(_0xdda3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdda3('0x3'));var db=require(_0xdda3('0x4'))['db'];var utils=require(_0xdda3('0x5'));var logger=require(_0xdda3('0x6'))('rpc');var config=require(_0xdda3('0x7'));var jayson=require(_0xdda3('0x8'));var client=jayson[_0xdda3('0x9')][_0xdda3('0xa')]({'port':0x232a});config[_0xdda3('0xb')]=_[_0xdda3('0xc')](config['redis'],{'host':_0xdda3('0xd'),'port':0x18eb});var socket=require(_0xdda3('0xe'))(new Redis(config[_0xdda3('0xb')]));require(_0xdda3('0xf'))[_0xdda3('0x10')](socket);function respondWithRpcPromise(_0x437361,_0x42eb0d,_0x46c5d7){return new BPromise(function(_0x7f0e37,_0x28e9fb){return client[_0xdda3('0x11')](_0x437361,_0x46c5d7)[_0xdda3('0x12')](function(_0x301e8b){logger['info']('Team,\x20%s,\x20%s',_0x42eb0d,_0xdda3('0x13'));logger[_0xdda3('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x42eb0d,_0xdda3('0x13'),JSON[_0xdda3('0x15')](_0x301e8b));if(_0x301e8b[_0xdda3('0x16')]){if(_0x301e8b[_0xdda3('0x16')]['code']===0x1f4){logger[_0xdda3('0x16')](_0xdda3('0x17'),_0x42eb0d,_0x301e8b[_0xdda3('0x16')][_0xdda3('0x18')]);return _0x28e9fb(_0x301e8b[_0xdda3('0x16')][_0xdda3('0x18')]);}logger['error'](_0xdda3('0x17'),_0x42eb0d,_0x301e8b[_0xdda3('0x16')][_0xdda3('0x18')]);return _0x7f0e37(_0x301e8b['error'][_0xdda3('0x18')]);}else{logger[_0xdda3('0x19')]('Team,\x20%s,\x20%s',_0x42eb0d,'request\x20sent');_0x7f0e37(_0x301e8b[_0xdda3('0x1a')][_0xdda3('0x18')]);}})[_0xdda3('0x1b')](function(_0x5f7f58){logger[_0xdda3('0x16')](_0xdda3('0x17'),_0x42eb0d,_0x5f7f58);_0x28e9fb(_0x5f7f58);});});}