9423452ab39fbca44205323f1b37ecd4bec47b52
[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 _0x509d=['Team,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x472157,_0x416c91){var _0x4e844e=function(_0x3d2c50){while(--_0x3d2c50){_0x472157['push'](_0x472157['shift']());}};_0x4e844e(++_0x416c91);}(_0x509d,0x14b));var _0xd509=function(_0x55b087,_0x2e94fa){_0x55b087=_0x55b087-0x0;var _0x583d66=_0x509d[_0x55b087];return _0x583d66;};'use strict';var _=require(_0xd509('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd509('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd509('0x2'));var db=require(_0xd509('0x3'))['db'];var utils=require(_0xd509('0x4'));var logger=require(_0xd509('0x5'))(_0xd509('0x6'));var config=require('../../config/environment');var jayson=require(_0xd509('0x7'));var client=jayson[_0xd509('0x8')][_0xd509('0x9')]({'port':0x232a});config[_0xd509('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd509('0xb'))(new Redis(config['redis']));require('./team.socket')[_0xd509('0xc')](socket);function respondWithRpcPromise(_0x2b87e8,_0x47a75f,_0x439edf){return new BPromise(function(_0x1f981a,_0x8b2e36){return client[_0xd509('0xd')](_0x2b87e8,_0x439edf)[_0xd509('0xe')](function(_0x102e97){logger[_0xd509('0xf')](_0xd509('0x10'),_0x47a75f,_0xd509('0x11'));logger[_0xd509('0x12')](_0xd509('0x13'),_0x47a75f,_0xd509('0x11'),JSON['stringify'](_0x102e97));if(_0x102e97['error']){if(_0x102e97['error'][_0xd509('0x14')]===0x1f4){logger['error'](_0xd509('0x10'),_0x47a75f,_0x102e97[_0xd509('0x15')][_0xd509('0x16')]);return _0x8b2e36(_0x102e97[_0xd509('0x15')]['message']);}logger[_0xd509('0x15')](_0xd509('0x10'),_0x47a75f,_0x102e97[_0xd509('0x15')][_0xd509('0x16')]);return _0x1f981a(_0x102e97[_0xd509('0x15')][_0xd509('0x16')]);}else{logger[_0xd509('0xf')]('Team,\x20%s,\x20%s',_0x47a75f,_0xd509('0x11'));_0x1f981a(_0x102e97[_0xd509('0x17')][_0xd509('0x16')]);}})[_0xd509('0x18')](function(_0x14d8bb){logger['error'](_0xd509('0x10'),_0x47a75f,_0x14d8bb);_0x8b2e36(_0x14d8bb);});});}