bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/handlers/breakoutStarted.js
2016-11-29 14:52:15 -02:00

39 lines
856 B
JavaScript

import Breakouts from '/imports/api/breakouts';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function handleBreakoutRoomStarted({ payload }) {
const {
meetingId,
timeRemaining,
externalMeetingId,
} = payload;
check(meetingId, String);
const selector = {
breakoutMeetingId: meetingId,
};
modifier = {
$set: {
users: [],
timeRemaining: Number(timeRemaining),
externalMeetingId: externalMeetingId,
},
};
const cb = (err, numChanged) => {
if (err) {
return Logger.error(`updating breakout: ${err}`);
}
if (numChanged) {
return Logger.info(`Updated timeRemaining and externalMeetingId ` +
`for breakout id=${meetingId}`);
}
};
return Breakouts.update(selector, modifier, cb);
}