bigbluebutton-Github/bigbluebutton-html5/imports/api/presentations/server/modifiers/removePresentation.js

29 lines
848 B
JavaScript
Raw Normal View History

2017-06-29 03:05:50 +08:00
import { check } from 'meteor/check';
import Presentations from '/imports/api/presentations';
2017-06-29 03:05:50 +08:00
import Logger from '/imports/startup/server/logger';
import clearSlidesPresentation from '/imports/api/slides/server/modifiers/clearSlidesPresentation';
2017-06-29 03:05:50 +08:00
export default async function removePresentation(meetingId, podId, presentationId) {
2017-06-29 03:05:50 +08:00
check(meetingId, String);
check(presentationId, String);
check(podId, String);
2017-06-29 03:05:50 +08:00
const selector = {
meetingId,
podId,
2017-07-25 02:46:53 +08:00
id: presentationId,
2017-06-29 03:05:50 +08:00
};
try {
const numberAffected = await Presentations.removeAsync(selector);
2017-06-29 03:05:50 +08:00
if (numberAffected) {
await clearSlidesPresentation(meetingId, presentationId);
2017-10-06 20:50:01 +08:00
Logger.info(`Removed presentation id=${presentationId} meeting=${meetingId}`);
2017-06-29 03:05:50 +08:00
}
} catch (err) {
Logger.error(`Removing presentation from collection: ${err}`);
}
2017-06-29 03:05:50 +08:00
}