f90a53e0838166df2ba46f3e41e9a5e9d5dd09c6
[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 _0xc4f6=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xc4f6,0x162));var _0x6c4f=function(_0x4faa16,_0x27ad68){_0x4faa16=_0x4faa16-0x0;var _0x5eaf3e=_0xc4f6[_0x4faa16];return _0x5eaf3e;};'use strict';var _=require('lodash');var util=require(_0x6c4f('0x0'));var moment=require('moment');var BPromise=require(_0x6c4f('0x1'));var rs=require(_0x6c4f('0x2'));var fs=require('fs');var Redis=require(_0x6c4f('0x3'));var db=require(_0x6c4f('0x4'))['db'];var utils=require(_0x6c4f('0x5'));var logger=require(_0x6c4f('0x6'))(_0x6c4f('0x7'));var config=require(_0x6c4f('0x8'));var jayson=require(_0x6c4f('0x9'));var client=jayson['client'][_0x6c4f('0xa')]({'port':0x232a});config[_0x6c4f('0xb')]=_['defaults'](config[_0x6c4f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c4f('0xb')]));require('./team.socket')[_0x6c4f('0xc')](socket);function respondWithRpcPromise(_0x2c29d3,_0x209038,_0x5754a9){return new BPromise(function(_0x2ebea6,_0x1ea0db){return client['request'](_0x2c29d3,_0x5754a9)[_0x6c4f('0xd')](function(_0x4f6e78){logger[_0x6c4f('0xe')](_0x6c4f('0xf'),_0x209038,_0x6c4f('0x10'));logger[_0x6c4f('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x209038,'request\x20sent',JSON[_0x6c4f('0x12')](_0x4f6e78));if(_0x4f6e78[_0x6c4f('0x13')]){if(_0x4f6e78['error'][_0x6c4f('0x14')]===0x1f4){logger[_0x6c4f('0x13')](_0x6c4f('0xf'),_0x209038,_0x4f6e78['error'][_0x6c4f('0x15')]);return _0x1ea0db(_0x4f6e78[_0x6c4f('0x13')]['message']);}logger[_0x6c4f('0x13')](_0x6c4f('0xf'),_0x209038,_0x4f6e78[_0x6c4f('0x13')][_0x6c4f('0x15')]);return _0x2ebea6(_0x4f6e78[_0x6c4f('0x13')]['message']);}else{logger[_0x6c4f('0xe')](_0x6c4f('0xf'),_0x209038,_0x6c4f('0x10'));_0x2ebea6(_0x4f6e78[_0x6c4f('0x16')][_0x6c4f('0x15')]);}})[_0x6c4f('0x17')](function(_0x508a22){logger[_0x6c4f('0x13')](_0x6c4f('0xf'),_0x209038,_0x508a22);_0x1ea0db(_0x508a22);});});}