Built motion from commit 10af8726.|2.6.34
[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 _0x24af=['defaults','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x1511d1,_0x93c805){var _0x3f0e3f=function(_0xc1dc38){while(--_0xc1dc38){_0x1511d1['push'](_0x1511d1['shift']());}};_0x3f0e3f(++_0x93c805);}(_0x24af,0x13b));var _0xf24a=function(_0x4e029f,_0x177074){_0x4e029f=_0x4e029f-0x0;var _0x135b7e=_0x24af[_0x4e029f];return _0x135b7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf24a('0x0'));var BPromise=require(_0xf24a('0x1'));var rs=require(_0xf24a('0x2'));var fs=require('fs');var Redis=require(_0xf24a('0x3'));var db=require(_0xf24a('0x4'))['db'];var utils=require(_0xf24a('0x5'));var logger=require(_0xf24a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf24a('0x7'));var client=jayson[_0xf24a('0x8')]['http']({'port':0x232a});config['redis']=_[_0xf24a('0x9')](config[_0xf24a('0xa')],{'host':_0xf24a('0xb'),'port':0x18eb});var socket=require(_0xf24a('0xc'))(new Redis(config[_0xf24a('0xa')]));require(_0xf24a('0xd'))[_0xf24a('0xe')](socket);function respondWithRpcPromise(_0x31ce41,_0x4a4b60,_0x192826){return new BPromise(function(_0x4993ea,_0x31eebb){return client[_0xf24a('0xf')](_0x31ce41,_0x192826)[_0xf24a('0x10')](function(_0x427ad){logger[_0xf24a('0x11')](_0xf24a('0x12'),_0x4a4b60,_0xf24a('0x13'));logger[_0xf24a('0x14')](_0xf24a('0x15'),_0x4a4b60,_0xf24a('0x13'),JSON[_0xf24a('0x16')](_0x427ad));if(_0x427ad[_0xf24a('0x17')]){if(_0x427ad[_0xf24a('0x17')][_0xf24a('0x18')]===0x1f4){logger[_0xf24a('0x17')](_0xf24a('0x12'),_0x4a4b60,_0x427ad[_0xf24a('0x17')][_0xf24a('0x19')]);return _0x31eebb(_0x427ad['error']['message']);}logger[_0xf24a('0x17')](_0xf24a('0x12'),_0x4a4b60,_0x427ad[_0xf24a('0x17')][_0xf24a('0x19')]);return _0x4993ea(_0x427ad[_0xf24a('0x17')]['message']);}else{logger[_0xf24a('0x11')](_0xf24a('0x12'),_0x4a4b60,_0xf24a('0x13'));_0x4993ea(_0x427ad['result']['message']);}})[_0xf24a('0x1a')](function(_0x3e9c7b){logger[_0xf24a('0x17')](_0xf24a('0x12'),_0x4a4b60,_0x3e9c7b);_0x31eebb(_0x3e9c7b);});});}