b41e4bee3b17db6992eb85a44a20c3d5b0165a73
[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 _0x2ab2=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x2ab2,0x7d));var _0x22ab=function(_0x501935,_0x30e020){_0x501935=_0x501935-0x0;var _0x402a12=_0x2ab2[_0x501935];return _0x402a12;};'use strict';var _=require(_0x22ab('0x0'));var util=require('util');var moment=require(_0x22ab('0x1'));var BPromise=require(_0x22ab('0x2'));var rs=require(_0x22ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22ab('0x4'))['db'];var utils=require(_0x22ab('0x5'));var logger=require(_0x22ab('0x6'))(_0x22ab('0x7'));var config=require(_0x22ab('0x8'));var jayson=require(_0x22ab('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x22ab('0xa')]=_[_0x22ab('0xb')](config[_0x22ab('0xa')],{'host':_0x22ab('0xc'),'port':0x18eb});var socket=require(_0x22ab('0xd'))(new Redis(config[_0x22ab('0xa')]));require(_0x22ab('0xe'))[_0x22ab('0xf')](socket);function respondWithRpcPromise(_0x2bb3ba,_0x24194b,_0x36c61e){return new BPromise(function(_0x2a1804,_0x3dcc98){return client[_0x22ab('0x10')](_0x2bb3ba,_0x36c61e)[_0x22ab('0x11')](function(_0x56339a){logger[_0x22ab('0x12')](_0x22ab('0x13'),_0x24194b,_0x22ab('0x14'));logger[_0x22ab('0x15')](_0x22ab('0x16'),_0x24194b,_0x22ab('0x14'),JSON[_0x22ab('0x17')](_0x56339a));if(_0x56339a[_0x22ab('0x18')]){if(_0x56339a[_0x22ab('0x18')][_0x22ab('0x19')]===0x1f4){logger['error'](_0x22ab('0x13'),_0x24194b,_0x56339a[_0x22ab('0x18')][_0x22ab('0x1a')]);return _0x3dcc98(_0x56339a[_0x22ab('0x18')]['message']);}logger[_0x22ab('0x18')](_0x22ab('0x13'),_0x24194b,_0x56339a[_0x22ab('0x18')][_0x22ab('0x1a')]);return _0x2a1804(_0x56339a[_0x22ab('0x18')]['message']);}else{logger['info']('Team,\x20%s,\x20%s',_0x24194b,_0x22ab('0x14'));_0x2a1804(_0x56339a[_0x22ab('0x1b')][_0x22ab('0x1a')]);}})[_0x22ab('0x1c')](function(_0x24d6f4){logger[_0x22ab('0x18')](_0x22ab('0x13'),_0x24194b,_0x24d6f4);_0x3dcc98(_0x24d6f4);});});}