0228fbdb10c35b496c18d68bb0f7992470551781
[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 _0xf026=['code','error','Team,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0xf026,0x17d));var _0x6f02=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xf026[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x6f02('0x0'));var util=require(_0x6f02('0x1'));var moment=require(_0x6f02('0x2'));var BPromise=require(_0x6f02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f02('0x4'));var db=require(_0x6f02('0x5'))['db'];var utils=require(_0x6f02('0x6'));var logger=require(_0x6f02('0x7'))(_0x6f02('0x8'));var config=require(_0x6f02('0x9'));var jayson=require(_0x6f02('0xa'));var client=jayson[_0x6f02('0xb')][_0x6f02('0xc')]({'port':0x232a});config[_0x6f02('0xd')]=_[_0x6f02('0xe')](config[_0x6f02('0xd')],{'host':_0x6f02('0xf'),'port':0x18eb});var socket=require(_0x6f02('0x10'))(new Redis(config[_0x6f02('0xd')]));require(_0x6f02('0x11'))[_0x6f02('0x12')](socket);function respondWithRpcPromise(_0x64fd2f,_0x172b6f,_0x2edc7f){return new BPromise(function(_0x437778,_0x4900ac){return client['request'](_0x64fd2f,_0x2edc7f)[_0x6f02('0x13')](function(_0x3fec82){logger[_0x6f02('0x14')]('Team,\x20%s,\x20%s',_0x172b6f,_0x6f02('0x15'));logger[_0x6f02('0x16')](_0x6f02('0x17'),_0x172b6f,_0x6f02('0x15'),JSON[_0x6f02('0x18')](_0x3fec82));if(_0x3fec82['error']){if(_0x3fec82['error'][_0x6f02('0x19')]===0x1f4){logger[_0x6f02('0x1a')](_0x6f02('0x1b'),_0x172b6f,_0x3fec82[_0x6f02('0x1a')][_0x6f02('0x1c')]);return _0x4900ac(_0x3fec82['error'][_0x6f02('0x1c')]);}logger[_0x6f02('0x1a')](_0x6f02('0x1b'),_0x172b6f,_0x3fec82[_0x6f02('0x1a')][_0x6f02('0x1c')]);return _0x437778(_0x3fec82['error'][_0x6f02('0x1c')]);}else{logger[_0x6f02('0x14')]('Team,\x20%s,\x20%s',_0x172b6f,_0x6f02('0x15'));_0x437778(_0x3fec82['result'][_0x6f02('0x1c')]);}})['catch'](function(_0x43c76d){logger[_0x6f02('0x1a')](_0x6f02('0x1b'),_0x172b6f,_0x43c76d);_0x4900ac(_0x43c76d);});});}