bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/handlers/breakoutStarted.js
2016-11-28 17:48:02 -02:00

39 lines
843 B
JavaScript

import Breakouts from '/imports/api/breakouts';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default function breakoutRoomStarted({ 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}`);
}
};
Breakouts.update(selector, modifier, cb);
}