87604e77edc7d7cd33e83492c1b5d673fdddf844
[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 _0x355c=['error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x355c,0x101));var _0xc355=function(_0xf3768d,_0x4902ff){_0xf3768d=_0xf3768d-0x0;var _0x540bf8=_0x355c[_0xf3768d];return _0x540bf8;};'use strict';var _=require(_0xc355('0x0'));var util=require(_0xc355('0x1'));var moment=require('moment');var BPromise=require(_0xc355('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc355('0x3'));var db=require(_0xc355('0x4'))['db'];var utils=require(_0xc355('0x5'));var logger=require(_0xc355('0x6'))(_0xc355('0x7'));var config=require(_0xc355('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc355('0x9')]['http']({'port':0x232a});config[_0xc355('0xa')]=_[_0xc355('0xb')](config[_0xc355('0xa')],{'host':_0xc355('0xc'),'port':0x18eb});var socket=require(_0xc355('0xd'))(new Redis(config[_0xc355('0xa')]));require(_0xc355('0xe'))[_0xc355('0xf')](socket);function respondWithRpcPromise(_0x21456a,_0x28fefc,_0x1b958b){return new BPromise(function(_0x49b795,_0x1b8737){return client[_0xc355('0x10')](_0x21456a,_0x1b958b)[_0xc355('0x11')](function(_0x2aac66){logger[_0xc355('0x12')](_0xc355('0x13'),_0x28fefc,_0xc355('0x14'));logger['debug'](_0xc355('0x15'),_0x28fefc,_0xc355('0x14'),JSON[_0xc355('0x16')](_0x2aac66));if(_0x2aac66['error']){if(_0x2aac66[_0xc355('0x17')][_0xc355('0x18')]===0x1f4){logger[_0xc355('0x17')](_0xc355('0x13'),_0x28fefc,_0x2aac66['error'][_0xc355('0x19')]);return _0x1b8737(_0x2aac66[_0xc355('0x17')][_0xc355('0x19')]);}logger[_0xc355('0x17')](_0xc355('0x13'),_0x28fefc,_0x2aac66[_0xc355('0x17')][_0xc355('0x19')]);return _0x49b795(_0x2aac66[_0xc355('0x17')][_0xc355('0x19')]);}else{logger[_0xc355('0x12')](_0xc355('0x13'),_0x28fefc,'request\x20sent');_0x49b795(_0x2aac66[_0xc355('0x1a')]['message']);}})[_0xc355('0x1b')](function(_0x598d6b){logger[_0xc355('0x17')](_0xc355('0x13'),_0x28fefc,_0x598d6b);_0x1b8737(_0x598d6b);});});}