Changes handlers for breakouts

This commit is contained in:
gcampes 2016-11-29 14:52:15 -02:00
parent 5089c18ef3
commit eba3e21e92
7 changed files with 19 additions and 19 deletions

View File

@ -1,13 +1,13 @@
import RedisPubSub from '/imports/startup/server/redis';
import createBreakout from './handlers/createBreakout';
import breakoutStarted from './handlers/breakoutStarted';
import breakoutJoinURL from './handlers/breakoutJoinURL';
import updateTimeRemaining from './handlers/updateTimeRemaining';
import breakoutClosed from './handlers/breakoutClosed';
import handleCreateBreakout from './handlers/createBreakout';
import handleBreakoutStarted from './handlers/breakoutStarted';
import handleBreakoutJoinURL from './handlers/breakoutJoinURL';
import handleUpdateTimeRemaining from './handlers/updateTimeRemaining';
import handleBreakoutClosed from './handlers/breakoutClosed';
RedisPubSub.on('CreateBreakoutRoomRequest', createBreakout);
RedisPubSub.on('BreakoutRoomStarted', breakoutStarted);
RedisPubSub.on('BreakoutRoomJoinURL', breakoutJoinURL);
RedisPubSub.on('BreakoutRoomsTimeRemainingUpdate', updateTimeRemaining);
RedisPubSub.on('BreakoutRoomClosed', breakoutClosed);
RedisPubSub.on('CreateBreakoutRoomRequest', handleCreateBreakout);
RedisPubSub.on('BreakoutRoomStarted', handleBreakoutStarted);
RedisPubSub.on('BreakoutRoomJoinURL', handleBreakoutJoinURL);
RedisPubSub.on('BreakoutRoomsTimeRemainingUpdate', handleUpdateTimeRemaining);
RedisPubSub.on('BreakoutRoomClosed', handleBreakoutClosed);

View File

@ -1,7 +1,7 @@
import clearBreakouts from '../modifiers/clearBreakouts';
import { check } from 'meteor/check';
export default function breakoutClosed({ payload }) {
export default function handleBreakoutClosed({ payload }) {
const meetingId = payload.meetingId;
check(meetingId, String);

View File

@ -5,8 +5,8 @@ import { check } from 'meteor/check';
import RedisPubSub from '/imports/startup/server/redis';
import { XMLHttpRequest } from 'xmlhttprequest';
import xml2js from 'xml2js';
const xmlParser = new xml2js.Parser();
import url from 'url';
const xmlParser = new xml2js.Parser();
const getUrlParams = urlToParse => {
const options = { parseQueryString: true };
@ -14,7 +14,7 @@ const getUrlParams = urlToParse => {
return parsedUrl.query;
};
export default function breakoutJoinURL({ payload }) {
export default function handleBreakoutJoinURL({ payload }) {
const REDIS_CONFIG = Meteor.settings.redis;
const CLIENT_HTML = 'HTML5';
@ -35,7 +35,7 @@ export default function breakoutJoinURL({ payload }) {
const res = Meteor.http.call('get', noRedirectJoinURL);
xmlParser.parseString(res.content, (err, parsedXML) => {
if (err) {
Logger.error(`An Error occured when parsing xml response for: ${noRedirectJoinURL}`);
return Logger.error(`An Error occured when parsing xml response for: ${noRedirectJoinURL}`);
}
breakout = Breakouts.findOne(selector);

View File

@ -2,7 +2,7 @@ import Breakouts from '/imports/api/breakouts';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function breakoutRoomStarted({ payload }) {
export default function handleBreakoutRoomStarted({ payload }) {
const {
meetingId,
timeRemaining,
@ -34,5 +34,5 @@ export default function breakoutRoomStarted({ payload }) {
}
};
Breakouts.update(selector, modifier, cb);
return Breakouts.update(selector, modifier, cb);
}

View File

@ -3,7 +3,7 @@ import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import addBreakout from '../modifiers/addBreakout';
export default function createBreakout({ payload }) {
export default function handleCreateBreakout({ payload }) {
const { breakoutMeetingId } = payload;
check(breakoutMeetingId, String);

View File

@ -2,7 +2,7 @@ import Breakouts from '/imports/api/breakouts';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function updateTimeRemaining({ payload }) {
export default function handleUpdateTimeRemaining({ payload }) {
const {
meetingId,
timeRemaining,

View File

@ -38,5 +38,5 @@ export default function addBreakout(payload) {
return Logger.info(`Upserted breakout id=${breakoutMeetingId}`);
};
Breakouts.upsert(selector, modifier, cb);
return Breakouts.upsert(selector, modifier, cb);
};