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

34 lines
769 B
JavaScript
Raw Normal View History

2016-11-15 00:12:54 +08:00
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Breakouts from '/imports/api/breakouts';
2016-11-14 19:57:10 +08:00
2023-03-02 00:38:40 +08:00
export default async function handleUpdateTimeRemaining({ body }, meetingId) {
2016-11-15 00:12:54 +08:00
const {
timeRemaining,
} = body;
2016-11-15 00:12:54 +08:00
check(meetingId, String);
check(timeRemaining, Number);
2016-11-14 19:57:10 +08:00
const selector = {
2016-11-29 03:48:02 +08:00
parentMeetingId: meetingId,
2016-11-14 19:57:10 +08:00
};
const modifier = {
$set: {
2017-06-03 03:25:02 +08:00
timeRemaining,
2016-11-14 19:57:10 +08:00
},
};
2016-11-24 00:13:41 +08:00
const options = {
multi: true,
};
2023-03-02 00:38:40 +08:00
const numberAffected = Breakouts.updateAsync(selector, modifier, options);
if (numberAffected) {
Logger.info(`Updated breakout time remaining for breakouts where parentMeetingId=${meetingId}`);
} else {
Logger.error(`Updating breakouts: ${numberAffected}`);
}
2016-11-14 19:57:10 +08:00
}