bigbluebutton-Github/bigbluebutton-html5/imports/api/slides/server/modifiers/clearSlides.js

39 lines
1.1 KiB
JavaScript
Raw Normal View History

import { Slides, SlidePositions } from '/imports/api/slides';
2016-10-21 19:41:17 +08:00
import Logger from '/imports/startup/server/logger';
2016-05-13 01:43:59 +08:00
export default async function clearSlides(meetingId) {
2016-10-21 19:41:17 +08:00
if (meetingId) {
try {
const numberAffectedSlidePositions = await SlidePositions.removeAsync({ meetingId });
const numberAffected = await Slides.removeAsync({ meetingId });
if (numberAffectedSlidePositions) {
Logger.info(`Cleared SlidePositions (${meetingId})`);
}
if (numberAffected) {
Logger.info(`Cleared Slides (${meetingId})`);
}
} catch (err) {
Logger.error(`Error on cleaning Slides (${meetingId}). ${err}`);
}
} else {
try {
const numberAffectedSlidePositions = await SlidePositions.removeAsync({ meetingId });
2016-11-18 20:28:55 +08:00
const numberAffected = await Slides.removeAsync({ meetingId });
if (numberAffectedSlidePositions) {
Logger.info(`Cleared SlidePositions (${meetingId})`);
}
if (numberAffected) {
Logger.info('Cleared Slides (all)');
}
} catch (err) {
Logger.error(`Error on cleaning Slides (all). ${err}`);
}
}
2017-06-03 03:25:02 +08:00
}