8c64fd78b5aa1dc47a9433b653a18b00dc95ae63
[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 _0xf107=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x1f787b,_0x52cab7){var _0x37fa0b=function(_0x1022d4){while(--_0x1022d4){_0x1f787b['push'](_0x1f787b['shift']());}};_0x37fa0b(++_0x52cab7);}(_0xf107,0x153));var _0x7f10=function(_0x5caee9,_0x2c4bb8){_0x5caee9=_0x5caee9-0x0;var _0x567931=_0xf107[_0x5caee9];return _0x567931;};'use strict';var _=require(_0x7f10('0x0'));var util=require(_0x7f10('0x1'));var moment=require(_0x7f10('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f10('0x5'))('rpc');var config=require(_0x7f10('0x6'));var jayson=require(_0x7f10('0x7'));var client=jayson[_0x7f10('0x8')]['http']({'port':0x232a});config[_0x7f10('0x9')]=_[_0x7f10('0xa')](config[_0x7f10('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f10('0xb'))(new Redis(config['redis']));require('./team.socket')[_0x7f10('0xc')](socket);function respondWithRpcPromise(_0x46e3e2,_0xe1256c,_0x4e1207){return new BPromise(function(_0xebe1a9,_0x1ae2b5){return client['request'](_0x46e3e2,_0x4e1207)['then'](function(_0x3ff046){logger[_0x7f10('0xd')](_0x7f10('0xe'),_0xe1256c,'request\x20sent');logger[_0x7f10('0xf')](_0x7f10('0x10'),_0xe1256c,'request\x20sent',JSON[_0x7f10('0x11')](_0x3ff046));if(_0x3ff046[_0x7f10('0x12')]){if(_0x3ff046[_0x7f10('0x12')][_0x7f10('0x13')]===0x1f4){logger['error'](_0x7f10('0xe'),_0xe1256c,_0x3ff046[_0x7f10('0x12')][_0x7f10('0x14')]);return _0x1ae2b5(_0x3ff046[_0x7f10('0x12')][_0x7f10('0x14')]);}logger[_0x7f10('0x12')](_0x7f10('0xe'),_0xe1256c,_0x3ff046['error'][_0x7f10('0x14')]);return _0xebe1a9(_0x3ff046[_0x7f10('0x12')]['message']);}else{logger[_0x7f10('0xd')](_0x7f10('0xe'),_0xe1256c,_0x7f10('0x15'));_0xebe1a9(_0x3ff046['result']['message']);}})[_0x7f10('0x16')](function(_0x18bcd3){logger[_0x7f10('0x12')](_0x7f10('0xe'),_0xe1256c,_0x18bcd3);_0x1ae2b5(_0x18bcd3);});});}