efc44a6c1200cc76ea860588bea550a29b927234
[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 _0xc9dd=['debug','stringify','error','code','Team,\x20%s,\x20%s','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./team.socket','register','request','then','info','request\x20sent'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xc9dd,0x7f));var _0xdc9d=function(_0x38336c,_0x14b20e){_0x38336c=_0x38336c-0x0;var _0x2d1fd5=_0xc9dd[_0x38336c];return _0x2d1fd5;};'use strict';var _=require('lodash');var util=require(_0xdc9d('0x0'));var moment=require('moment');var BPromise=require(_0xdc9d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdc9d('0x2'));var db=require(_0xdc9d('0x3'))['db'];var utils=require(_0xdc9d('0x4'));var logger=require(_0xdc9d('0x5'))(_0xdc9d('0x6'));var config=require(_0xdc9d('0x7'));var jayson=require(_0xdc9d('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xdc9d('0x9')]=_[_0xdc9d('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdc9d('0xb'))[_0xdc9d('0xc')](socket);function respondWithRpcPromise(_0x427abc,_0x2a509d,_0x25dddc){return new BPromise(function(_0x39fd4a,_0x32e6ae){return client[_0xdc9d('0xd')](_0x427abc,_0x25dddc)[_0xdc9d('0xe')](function(_0x5c1f41){logger[_0xdc9d('0xf')]('Team,\x20%s,\x20%s',_0x2a509d,_0xdc9d('0x10'));logger[_0xdc9d('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x2a509d,'request\x20sent',JSON[_0xdc9d('0x12')](_0x5c1f41));if(_0x5c1f41[_0xdc9d('0x13')]){if(_0x5c1f41[_0xdc9d('0x13')][_0xdc9d('0x14')]===0x1f4){logger[_0xdc9d('0x13')](_0xdc9d('0x15'),_0x2a509d,_0x5c1f41[_0xdc9d('0x13')][_0xdc9d('0x16')]);return _0x32e6ae(_0x5c1f41[_0xdc9d('0x13')][_0xdc9d('0x16')]);}logger[_0xdc9d('0x13')]('Team,\x20%s,\x20%s',_0x2a509d,_0x5c1f41['error']['message']);return _0x39fd4a(_0x5c1f41[_0xdc9d('0x13')][_0xdc9d('0x16')]);}else{logger[_0xdc9d('0xf')]('Team,\x20%s,\x20%s',_0x2a509d,'request\x20sent');_0x39fd4a(_0x5c1f41['result']['message']);}})[_0xdc9d('0x17')](function(_0x3f15e5){logger[_0xdc9d('0x13')](_0xdc9d('0x15'),_0x2a509d,_0x3f15e5);_0x32e6ae(_0x3f15e5);});});}