bigbluebutton-Github/bigbluebutton-html5/imports/api/breakouts/server/handlers/updateTimeRemaining.js
2023-03-01 13:38:40 -03:00

34 lines
769 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Breakouts from '/imports/api/breakouts';
export default async function handleUpdateTimeRemaining({ body }, meetingId) {
const {
timeRemaining,
} = body;
check(meetingId, String);
check(timeRemaining, Number);
const selector = {
parentMeetingId: meetingId,
};
const modifier = {
$set: {
timeRemaining,
},
};
const options = {
multi: true,
};
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}`);
}
}