Built motion from commit (unavailable).|2.5.28
[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 _0x4ad6=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4ad6,0xf1));var _0x64ad=function(_0x4b059c,_0x32895e){_0x4b059c=_0x4b059c-0x0;var _0x222c8a=_0x4ad6[_0x4b059c];return _0x222c8a;};'use strict';var _=require(_0x64ad('0x0'));var util=require(_0x64ad('0x1'));var moment=require(_0x64ad('0x2'));var BPromise=require(_0x64ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64ad('0x4'));var db=require(_0x64ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x64ad('0x6'));var client=jayson[_0x64ad('0x7')]['http']({'port':0x232a});config[_0x64ad('0x8')]=_[_0x64ad('0x9')](config['redis'],{'host':_0x64ad('0xa'),'port':0x18eb});var socket=require(_0x64ad('0xb'))(new Redis(config[_0x64ad('0x8')]));require(_0x64ad('0xc'))[_0x64ad('0xd')](socket);function respondWithRpcPromise(_0x4a5996,_0x3976d6,_0x463205){return new BPromise(function(_0x398d6b,_0x23a5e4){return client['request'](_0x4a5996,_0x463205)[_0x64ad('0xe')](function(_0x410e99){logger['info'](_0x64ad('0xf'),_0x3976d6,_0x64ad('0x10'));logger[_0x64ad('0x11')](_0x64ad('0x12'),_0x3976d6,_0x64ad('0x10'),JSON['stringify'](_0x410e99));if(_0x410e99[_0x64ad('0x13')]){if(_0x410e99['error'][_0x64ad('0x14')]===0x1f4){logger[_0x64ad('0x13')]('Team,\x20%s,\x20%s',_0x3976d6,_0x410e99[_0x64ad('0x13')][_0x64ad('0x15')]);return _0x23a5e4(_0x410e99[_0x64ad('0x13')][_0x64ad('0x15')]);}logger[_0x64ad('0x13')]('Team,\x20%s,\x20%s',_0x3976d6,_0x410e99['error'][_0x64ad('0x15')]);return _0x398d6b(_0x410e99[_0x64ad('0x13')][_0x64ad('0x15')]);}else{logger[_0x64ad('0x16')](_0x64ad('0xf'),_0x3976d6,'request\x20sent');_0x398d6b(_0x410e99['result'][_0x64ad('0x15')]);}})[_0x64ad('0x17')](function(_0x3dee01){logger[_0x64ad('0x13')](_0x64ad('0xf'),_0x3976d6,_0x3dee01);_0x23a5e4(_0x3dee01);});});}