Built motion from commit 52c8a02d.|2.6.29
[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 _0xa264=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','info','result','catch'];(function(_0x240760,_0x591ba1){var _0xe5b5aa=function(_0x3018bc){while(--_0x3018bc){_0x240760['push'](_0x240760['shift']());}};_0xe5b5aa(++_0x591ba1);}(_0xa264,0x170));var _0x4a26=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xa264[_0xcf5436];return _0xc4f5c8;};'use strict';var _=require('lodash');var util=require(_0x4a26('0x0'));var moment=require(_0x4a26('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a26('0x2'));var db=require(_0x4a26('0x3'))['db'];var utils=require(_0x4a26('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a26('0x5'));var jayson=require(_0x4a26('0x6'));var client=jayson['client'][_0x4a26('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4a26('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a26('0x9'))(new Redis(config[_0x4a26('0x8')]));require('./team.socket')[_0x4a26('0xa')](socket);function respondWithRpcPromise(_0x4fb3c3,_0x595e5e,_0x42c38e){return new BPromise(function(_0x2496f8,_0x1fc2ce){return client[_0x4a26('0xb')](_0x4fb3c3,_0x42c38e)[_0x4a26('0xc')](function(_0x4714e2){logger['info']('Team,\x20%s,\x20%s',_0x595e5e,_0x4a26('0xd'));logger[_0x4a26('0xe')]('Team,\x20%s,\x20%s,\x20%s',_0x595e5e,_0x4a26('0xd'),JSON[_0x4a26('0xf')](_0x4714e2));if(_0x4714e2['error']){if(_0x4714e2[_0x4a26('0x10')][_0x4a26('0x11')]===0x1f4){logger[_0x4a26('0x10')](_0x4a26('0x12'),_0x595e5e,_0x4714e2[_0x4a26('0x10')][_0x4a26('0x13')]);return _0x1fc2ce(_0x4714e2[_0x4a26('0x10')][_0x4a26('0x13')]);}logger[_0x4a26('0x10')](_0x4a26('0x12'),_0x595e5e,_0x4714e2[_0x4a26('0x10')][_0x4a26('0x13')]);return _0x2496f8(_0x4714e2[_0x4a26('0x10')][_0x4a26('0x13')]);}else{logger[_0x4a26('0x14')](_0x4a26('0x12'),_0x595e5e,_0x4a26('0xd'));_0x2496f8(_0x4714e2[_0x4a26('0x15')][_0x4a26('0x13')]);}})[_0x4a26('0x16')](function(_0x1461ca){logger[_0x4a26('0x10')](_0x4a26('0x12'),_0x595e5e,_0x1461ca);_0x1fc2ce(_0x1461ca);});});}