651b35507ab6563ff0789cfb48a745dc1d96aee5
[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 _0x40bb=['client','http','redis','defaults','socket.io-emitter','./team.socket','register','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x40bb,0x147));var _0xb40b=function(_0x18d891,_0x467c93){_0x18d891=_0x18d891-0x0;var _0x4c4851=_0x40bb[_0x18d891];return _0x4c4851;};'use strict';var _=require('lodash');var util=require(_0xb40b('0x0'));var moment=require(_0xb40b('0x1'));var BPromise=require(_0xb40b('0x2'));var rs=require(_0xb40b('0x3'));var fs=require('fs');var Redis=require(_0xb40b('0x4'));var db=require(_0xb40b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb40b('0x6'))('rpc');var config=require(_0xb40b('0x7'));var jayson=require(_0xb40b('0x8'));var client=jayson[_0xb40b('0x9')][_0xb40b('0xa')]({'port':0x232a});config[_0xb40b('0xb')]=_[_0xb40b('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb40b('0xd'))(new Redis(config[_0xb40b('0xb')]));require(_0xb40b('0xe'))[_0xb40b('0xf')](socket);function respondWithRpcPromise(_0xc5b886,_0x42bdb7,_0x290cc1){return new BPromise(function(_0x46bc0e,_0x5dec87){return client['request'](_0xc5b886,_0x290cc1)[_0xb40b('0x10')](function(_0x5bc307){logger[_0xb40b('0x11')]('Team,\x20%s,\x20%s',_0x42bdb7,_0xb40b('0x12'));logger[_0xb40b('0x13')](_0xb40b('0x14'),_0x42bdb7,_0xb40b('0x12'),JSON[_0xb40b('0x15')](_0x5bc307));if(_0x5bc307[_0xb40b('0x16')]){if(_0x5bc307[_0xb40b('0x16')][_0xb40b('0x17')]===0x1f4){logger[_0xb40b('0x16')](_0xb40b('0x18'),_0x42bdb7,_0x5bc307[_0xb40b('0x16')][_0xb40b('0x19')]);return _0x5dec87(_0x5bc307[_0xb40b('0x16')][_0xb40b('0x19')]);}logger[_0xb40b('0x16')](_0xb40b('0x18'),_0x42bdb7,_0x5bc307[_0xb40b('0x16')]['message']);return _0x46bc0e(_0x5bc307[_0xb40b('0x16')][_0xb40b('0x19')]);}else{logger[_0xb40b('0x11')](_0xb40b('0x18'),_0x42bdb7,_0xb40b('0x12'));_0x46bc0e(_0x5bc307[_0xb40b('0x1a')][_0xb40b('0x19')]);}})[_0xb40b('0x1b')](function(_0x57bdfd){logger[_0xb40b('0x16')](_0xb40b('0x18'),_0x42bdb7,_0x57bdfd);_0x5dec87(_0x57bdfd);});});}