2017-06-29 03:05:50 +08:00
|
|
|
import { check } from 'meteor/check';
|
2017-10-12 10:00:28 +08:00
|
|
|
import Presentations from '/imports/api/presentations';
|
2017-06-29 03:05:50 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2017-10-12 10:00:28 +08:00
|
|
|
import clearSlidesPresentation from '/imports/api/slides/server/modifiers/clearSlidesPresentation';
|
2017-06-29 03:05:50 +08:00
|
|
|
|
2018-04-10 03:48:37 +08:00
|
|
|
export default function removePresentation(meetingId, podId, presentationId) {
|
2017-06-29 03:05:50 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(presentationId, String);
|
2018-04-10 03:48:37 +08:00
|
|
|
check(podId, String);
|
2017-06-29 03:05:50 +08:00
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
2018-04-10 03:48:37 +08:00
|
|
|
podId,
|
2017-07-25 02:46:53 +08:00
|
|
|
id: presentationId,
|
2017-06-29 03:05:50 +08:00
|
|
|
};
|
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = Presentations.remove(selector);
|
2017-06-29 03:05:50 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
2017-06-29 03:05:50 +08:00
|
|
|
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
|
|
|
}
|
2020-11-23 21:13:46 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Removing presentation from collection: ${err}`);
|
|
|
|
}
|
2017-06-29 03:05:50 +08:00
|
|
|
}
|