Built motion from commit (unavailable).|2.5.1
[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 _0x9a34=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x397c59,_0x340522){var _0x5cbc4a=function(_0x50fd97){while(--_0x50fd97){_0x397c59['push'](_0x397c59['shift']());}};_0x5cbc4a(++_0x340522);}(_0x9a34,0x92));var _0x49a3=function(_0x251009,_0x3f26d3){_0x251009=_0x251009-0x0;var _0x314bb9=_0x9a34[_0x251009];return _0x314bb9;};'use strict';var _=require(_0x49a3('0x0'));var util=require(_0x49a3('0x1'));var moment=require(_0x49a3('0x2'));var BPromise=require(_0x49a3('0x3'));var rs=require(_0x49a3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49a3('0x5'))['db'];var utils=require(_0x49a3('0x6'));var logger=require(_0x49a3('0x7'))(_0x49a3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x49a3('0x9')][_0x49a3('0xa')]({'port':0x232a});config['redis']=_[_0x49a3('0xb')](config[_0x49a3('0xc')],{'host':_0x49a3('0xd'),'port':0x18eb});var socket=require(_0x49a3('0xe'))(new Redis(config[_0x49a3('0xc')]));require('./team.socket')[_0x49a3('0xf')](socket);function respondWithRpcPromise(_0x328d7e,_0x53adb9,_0x122bed){return new BPromise(function(_0x205a82,_0xf99f46){return client[_0x49a3('0x10')](_0x328d7e,_0x122bed)[_0x49a3('0x11')](function(_0x395911){logger[_0x49a3('0x12')](_0x49a3('0x13'),_0x53adb9,_0x49a3('0x14'));logger[_0x49a3('0x15')](_0x49a3('0x16'),_0x53adb9,_0x49a3('0x14'),JSON[_0x49a3('0x17')](_0x395911));if(_0x395911[_0x49a3('0x18')]){if(_0x395911[_0x49a3('0x18')][_0x49a3('0x19')]===0x1f4){logger[_0x49a3('0x18')](_0x49a3('0x13'),_0x53adb9,_0x395911[_0x49a3('0x18')][_0x49a3('0x1a')]);return _0xf99f46(_0x395911['error']['message']);}logger[_0x49a3('0x18')]('Team,\x20%s,\x20%s',_0x53adb9,_0x395911['error'][_0x49a3('0x1a')]);return _0x205a82(_0x395911[_0x49a3('0x18')][_0x49a3('0x1a')]);}else{logger[_0x49a3('0x12')](_0x49a3('0x13'),_0x53adb9,_0x49a3('0x14'));_0x205a82(_0x395911[_0x49a3('0x1b')][_0x49a3('0x1a')]);}})['catch'](function(_0x4f08a9){logger[_0x49a3('0x18')](_0x49a3('0x13'),_0x53adb9,_0x4f08a9);_0xf99f46(_0x4f08a9);});});}