bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/handlers/breakoutStarted.js
2017-06-02 19:25:02 +00:00

39 lines
837 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,
},
};
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);
}