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

37 lines
775 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
export default 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,
};
try {
const numberAffected = Breakouts.update(selector, modifier, options);
if (numberAffected) {
Logger.info(`Updated breakout time remaining for breakouts where parentMeetingId=${meetingId}`);
}
} catch (err) {
Logger.error(`Updating breakouts: ${err}`);
}
2016-11-14 19:57:10 +08:00
}