Built motion from commit 3061e47c.|2.6.31
[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 _0x3e18=['../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','request','info','request\x20sent','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../config/utils'];(function(_0x1e73fc,_0x356ea1){var _0x54a46f=function(_0x5968e7){while(--_0x5968e7){_0x1e73fc['push'](_0x1e73fc['shift']());}};_0x54a46f(++_0x356ea1);}(_0x3e18,0x65));var _0x83e1=function(_0x40e135,_0x5ccf74){_0x40e135=_0x40e135-0x0;var _0x239f7c=_0x3e18[_0x40e135];return _0x239f7c;};'use strict';var _=require(_0x83e1('0x0'));var util=require('util');var moment=require(_0x83e1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83e1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x83e1('0x3'));var logger=require(_0x83e1('0x4'))(_0x83e1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x83e1('0x6')][_0x83e1('0x7')]({'port':0x232a});config['redis']=_[_0x83e1('0x8')](config['redis'],{'host':_0x83e1('0x9'),'port':0x18eb});var socket=require(_0x83e1('0xa'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x3d479c,_0x2ac065,_0x27a3dd){return new BPromise(function(_0x4f2ba3,_0x3c403a){return client[_0x83e1('0xb')](_0x3d479c,_0x27a3dd)['then'](function(_0x1c89f2){logger[_0x83e1('0xc')]('Team,\x20%s,\x20%s',_0x2ac065,_0x83e1('0xd'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x2ac065,_0x83e1('0xd'),JSON[_0x83e1('0xe')](_0x1c89f2));if(_0x1c89f2['error']){if(_0x1c89f2[_0x83e1('0xf')][_0x83e1('0x10')]===0x1f4){logger[_0x83e1('0xf')](_0x83e1('0x11'),_0x2ac065,_0x1c89f2['error'][_0x83e1('0x12')]);return _0x3c403a(_0x1c89f2[_0x83e1('0xf')][_0x83e1('0x12')]);}logger[_0x83e1('0xf')](_0x83e1('0x11'),_0x2ac065,_0x1c89f2['error'][_0x83e1('0x12')]);return _0x4f2ba3(_0x1c89f2[_0x83e1('0xf')][_0x83e1('0x12')]);}else{logger[_0x83e1('0xc')]('Team,\x20%s,\x20%s',_0x2ac065,_0x83e1('0xd'));_0x4f2ba3(_0x1c89f2[_0x83e1('0x13')][_0x83e1('0x12')]);}})[_0x83e1('0x14')](function(_0x5bf392){logger[_0x83e1('0xf')]('Team,\x20%s,\x20%s',_0x2ac065,_0x5bf392);_0x3c403a(_0x5bf392);});});}