bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/handlers/breakoutStarted.js

39 lines
837 B
JavaScript
Raw Normal View History

2016-11-14 19:57:10 +08:00
import Breakouts from '/imports/api/breakouts';
import Logger from '/imports/startup/server/logger';
2016-11-15 00:12:54 +08:00
import { check } from 'meteor/check';
2016-11-14 19:57:10 +08:00
2016-11-30 00:52:15 +08:00
export default function handleBreakoutRoomStarted({ payload }) {
2016-11-29 03:48:02 +08:00
const {
meetingId,
timeRemaining,
externalMeetingId,
} = payload;
2016-11-15 00:12:54 +08:00
check(meetingId, String);
2016-11-14 19:57:10 +08:00
const selector = {
2016-11-29 03:48:02 +08:00
breakoutMeetingId: meetingId,
2016-11-14 19:57:10 +08:00
};
modifier = {
$set: {
users: [],
2016-11-29 03:48:02 +08:00
timeRemaining: Number(timeRemaining),
2017-06-03 03:25:02 +08:00
externalMeetingId,
2016-11-14 19:57:10 +08:00
},
};
const cb = (err, numChanged) => {
if (err) {
2016-11-29 03:48:02 +08:00
return Logger.error(`updating breakout: ${err}`);
2016-11-14 19:57:10 +08:00
}
2016-11-29 03:48:02 +08:00
if (numChanged) {
2017-06-03 03:25:02 +08:00
return Logger.info('Updated timeRemaining and externalMeetingId ' +
2016-11-29 03:48:02 +08:00
`for breakout id=${meetingId}`);
2016-11-14 19:57:10 +08:00
}
};
2016-11-30 00:52:15 +08:00
return Breakouts.update(selector, modifier, cb);
2016-11-14 19:57:10 +08:00
}