18f86f9b319083b2b94040f8376363dd408fce43
[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 _0xfff3=['localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x4ec926,_0x273d7f){var _0x1c352d=function(_0x292f9b){while(--_0x292f9b){_0x4ec926['push'](_0x4ec926['shift']());}};_0x1c352d(++_0x273d7f);}(_0xfff3,0x79));var _0x3fff=function(_0x416226,_0x5970b0){_0x416226=_0x416226-0x0;var _0x1d55f3=_0xfff3[_0x416226];return _0x1d55f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3fff('0x0'));var BPromise=require(_0x3fff('0x1'));var rs=require(_0x3fff('0x2'));var fs=require('fs');var Redis=require(_0x3fff('0x3'));var db=require(_0x3fff('0x4'))['db'];var utils=require(_0x3fff('0x5'));var logger=require(_0x3fff('0x6'))(_0x3fff('0x7'));var config=require(_0x3fff('0x8'));var jayson=require(_0x3fff('0x9'));var client=jayson[_0x3fff('0xa')][_0x3fff('0xb')]({'port':0x232a});config['redis']=_[_0x3fff('0xc')](config[_0x3fff('0xd')],{'host':_0x3fff('0xe'),'port':0x18eb});var socket=require(_0x3fff('0xf'))(new Redis(config[_0x3fff('0xd')]));require(_0x3fff('0x10'))['register'](socket);function respondWithRpcPromise(_0x376346,_0x3a73ac,_0x45ce4c){return new BPromise(function(_0xf04304,_0x3b14f5){return client[_0x3fff('0x11')](_0x376346,_0x45ce4c)[_0x3fff('0x12')](function(_0x32ecaf){logger[_0x3fff('0x13')](_0x3fff('0x14'),_0x3a73ac,_0x3fff('0x15'));logger[_0x3fff('0x16')](_0x3fff('0x17'),_0x3a73ac,'request\x20sent',JSON['stringify'](_0x32ecaf));if(_0x32ecaf['error']){if(_0x32ecaf[_0x3fff('0x18')][_0x3fff('0x19')]===0x1f4){logger[_0x3fff('0x18')](_0x3fff('0x14'),_0x3a73ac,_0x32ecaf[_0x3fff('0x18')][_0x3fff('0x1a')]);return _0x3b14f5(_0x32ecaf[_0x3fff('0x18')][_0x3fff('0x1a')]);}logger[_0x3fff('0x18')](_0x3fff('0x14'),_0x3a73ac,_0x32ecaf[_0x3fff('0x18')][_0x3fff('0x1a')]);return _0xf04304(_0x32ecaf[_0x3fff('0x18')][_0x3fff('0x1a')]);}else{logger['info'](_0x3fff('0x14'),_0x3a73ac,_0x3fff('0x15'));_0xf04304(_0x32ecaf['result'][_0x3fff('0x1a')]);}})['catch'](function(_0x3fdf3e){logger['error']('Team,\x20%s,\x20%s',_0x3a73ac,_0x3fdf3e);_0x3b14f5(_0x3fdf3e);});});}