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
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
export default async 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 {
|
2023-04-01 04:40:41 +08:00
|
|
|
const numberAffected = await Presentations.removeAsync(selector);
|
2017-06-29 03:05:50 +08:00
|
|
|
|
2020-11-23 21:13:46 +08:00
|
|
|
if (numberAffected) {
|
2023-04-01 04:40:41 +08:00
|
|
|
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
|
|
|
}
|
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
|
|
|
}
|