Built motion from commit e8da49ee.|2.6.33
[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 _0x5756=['socket.io-emitter','redis','register','then','request\x20sent','debug','stringify','error','code','message','info','result','Team,\x20%s,\x20%s','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0x44d81a,_0x46f7a5){var _0x1b01cc=function(_0x5c3375){while(--_0x5c3375){_0x44d81a['push'](_0x44d81a['shift']());}};_0x1b01cc(++_0x46f7a5);}(_0x5756,0xdc));var _0x6575=function(_0x365eff,_0x40f55c){_0x365eff=_0x365eff-0x0;var _0x2bf075=_0x5756[_0x365eff];return _0x2bf075;};'use strict';var _=require(_0x6575('0x0'));var util=require('util');var moment=require(_0x6575('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6575('0x2'));var db=require(_0x6575('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6575('0x4'))(_0x6575('0x5'));var config=require(_0x6575('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6575('0x7')][_0x6575('0x8')]({'port':0x232a});config['redis']=_[_0x6575('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6575('0xa'))(new Redis(config[_0x6575('0xb')]));require('./team.socket')[_0x6575('0xc')](socket);function respondWithRpcPromise(_0x5730e2,_0x533c94,_0x255f57){return new BPromise(function(_0x2649df,_0xd50bec){return client['request'](_0x5730e2,_0x255f57)[_0x6575('0xd')](function(_0x4b865c){logger['info']('Team,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'));logger[_0x6575('0xf')]('Team,\x20%s,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'),JSON[_0x6575('0x10')](_0x4b865c));if(_0x4b865c['error']){if(_0x4b865c[_0x6575('0x11')][_0x6575('0x12')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x533c94,_0x4b865c['error'][_0x6575('0x13')]);return _0xd50bec(_0x4b865c[_0x6575('0x11')][_0x6575('0x13')]);}logger['error']('Team,\x20%s,\x20%s',_0x533c94,_0x4b865c[_0x6575('0x11')]['message']);return _0x2649df(_0x4b865c['error']['message']);}else{logger[_0x6575('0x14')]('Team,\x20%s,\x20%s',_0x533c94,_0x6575('0xe'));_0x2649df(_0x4b865c[_0x6575('0x15')][_0x6575('0x13')]);}})['catch'](function(_0x224f8f){logger[_0x6575('0x11')](_0x6575('0x16'),_0x533c94,_0x224f8f);_0xd50bec(_0x224f8f);});});}