Built motion from commit 3e059bc2.|2.5.32
[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 _0x088a=['stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x13cab2,_0x148058){var _0x292c90=function(_0x495f78){while(--_0x495f78){_0x13cab2['push'](_0x13cab2['shift']());}};_0x292c90(++_0x148058);}(_0x088a,0x1ce));var _0xa088=function(_0x5b4767,_0x18919c){_0x5b4767=_0x5b4767-0x0;var _0x4ba53e=_0x088a[_0x5b4767];return _0x4ba53e;};'use strict';var _=require('lodash');var util=require(_0xa088('0x0'));var moment=require(_0xa088('0x1'));var BPromise=require(_0xa088('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa088('0x3'));var db=require(_0xa088('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa088('0x5'))(_0xa088('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa088('0x7')]['http']({'port':0x232a});config[_0xa088('0x8')]=_[_0xa088('0x9')](config[_0xa088('0x8')],{'host':_0xa088('0xa'),'port':0x18eb});var socket=require(_0xa088('0xb'))(new Redis(config[_0xa088('0x8')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x2d7ae2,_0x4a73fd,_0x5ad30c){return new BPromise(function(_0x48a81f,_0x3f6241){return client['request'](_0x2d7ae2,_0x5ad30c)[_0xa088('0xc')](function(_0x44680d){logger[_0xa088('0xd')](_0xa088('0xe'),_0x4a73fd,_0xa088('0xf'));logger[_0xa088('0x10')](_0xa088('0x11'),_0x4a73fd,_0xa088('0xf'),JSON[_0xa088('0x12')](_0x44680d));if(_0x44680d[_0xa088('0x13')]){if(_0x44680d[_0xa088('0x13')][_0xa088('0x14')]===0x1f4){logger['error'](_0xa088('0xe'),_0x4a73fd,_0x44680d['error'][_0xa088('0x15')]);return _0x3f6241(_0x44680d['error']['message']);}logger[_0xa088('0x13')](_0xa088('0xe'),_0x4a73fd,_0x44680d['error'][_0xa088('0x15')]);return _0x48a81f(_0x44680d[_0xa088('0x13')][_0xa088('0x15')]);}else{logger[_0xa088('0xd')](_0xa088('0xe'),_0x4a73fd,'request\x20sent');_0x48a81f(_0x44680d[_0xa088('0x16')][_0xa088('0x15')]);}})[_0xa088('0x17')](function(_0x1221b7){logger[_0xa088('0x13')](_0xa088('0xe'),_0x4a73fd,_0x1221b7);_0x3f6241(_0x1221b7);});});}