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

29 lines
831 B
JavaScript
Raw Normal View History

2017-06-29 03:05:50 +08:00
import Slides from '/imports/api/2.0/slides';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
import clearAnnotations from '/imports/api/2.0/annotations/server/modifiers/clearAnnotations';
2017-06-29 03:05:50 +08:00
export default function clearSlidesPresentation(meetingId, presentationId) {
check(meetingId, String);
check(presentationId, String);
const selector = {
meetingId,
presentationId,
};
2017-07-27 00:39:53 +08:00
const whiteboardIds = Slides.find(selector).map(row => row.id);
2017-06-29 03:05:50 +08:00
const cb = (err) => {
2017-06-29 03:05:50 +08:00
if (err) {
return Logger.error(`Removing Slides from collection: ${err}`);
}
whiteboardIds.forEach(whiteboardId => clearAnnotations(meetingId, whiteboardId));
2017-06-29 03:05:50 +08:00
return Logger.info(`Removed Slides where presentationId=${presentationId}`);
2017-06-29 03:05:50 +08:00
};
return Slides.remove(selector, cb);
}