5a6d84bc8e7b9dbe4363e17944cdfa8f41997e5a
[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 _0xe31d=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xf6a62,_0x557fc6){var _0x4361b1=function(_0xa8969e){while(--_0xa8969e){_0xf6a62['push'](_0xf6a62['shift']());}};_0x4361b1(++_0x557fc6);}(_0xe31d,0x12f));var _0xde31=function(_0x591b22,_0xae1a71){_0x591b22=_0x591b22-0x0;var _0x2811f7=_0xe31d[_0x591b22];return _0x2811f7;};'use strict';var _=require(_0xde31('0x0'));var util=require('util');var moment=require(_0xde31('0x1'));var BPromise=require(_0xde31('0x2'));var rs=require(_0xde31('0x3'));var fs=require('fs');var Redis=require(_0xde31('0x4'));var db=require(_0xde31('0x5'))['db'];var utils=require(_0xde31('0x6'));var logger=require(_0xde31('0x7'))(_0xde31('0x8'));var config=require(_0xde31('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde31('0xa')]['http']({'port':0x232a});config['redis']=_[_0xde31('0xb')](config[_0xde31('0xc')],{'host':_0xde31('0xd'),'port':0x18eb});var socket=require(_0xde31('0xe'))(new Redis(config[_0xde31('0xc')]));require(_0xde31('0xf'))[_0xde31('0x10')](socket);function respondWithRpcPromise(_0x58c107,_0x313a19,_0x11b1d7){return new BPromise(function(_0x213e91,_0x50bd37){return client[_0xde31('0x11')](_0x58c107,_0x11b1d7)[_0xde31('0x12')](function(_0x5b4a6c){logger[_0xde31('0x13')](_0xde31('0x14'),_0x313a19,'request\x20sent');logger[_0xde31('0x15')](_0xde31('0x16'),_0x313a19,_0xde31('0x17'),JSON[_0xde31('0x18')](_0x5b4a6c));if(_0x5b4a6c['error']){if(_0x5b4a6c[_0xde31('0x19')][_0xde31('0x1a')]===0x1f4){logger[_0xde31('0x19')](_0xde31('0x14'),_0x313a19,_0x5b4a6c[_0xde31('0x19')][_0xde31('0x1b')]);return _0x50bd37(_0x5b4a6c[_0xde31('0x19')]['message']);}logger[_0xde31('0x19')]('Team,\x20%s,\x20%s',_0x313a19,_0x5b4a6c[_0xde31('0x19')][_0xde31('0x1b')]);return _0x213e91(_0x5b4a6c[_0xde31('0x19')]['message']);}else{logger[_0xde31('0x13')](_0xde31('0x14'),_0x313a19,'request\x20sent');_0x213e91(_0x5b4a6c[_0xde31('0x1c')][_0xde31('0x1b')]);}})[_0xde31('0x1d')](function(_0x4eb4e2){logger[_0xde31('0x19')](_0xde31('0x14'),_0x313a19,_0x4eb4e2);_0x50bd37(_0x4eb4e2);});});}