2018-04-06 04:56:41 +08:00
|
|
|
import { check } from 'meteor/check';
|
2018-04-06 06:00:52 +08:00
|
|
|
import PresentationPods from '/imports/api/presentation-pods';
|
2018-04-06 04:56:41 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import clearPresentations from '/imports/api/presentations/server/modifiers/clearPresentations';
|
2018-09-20 01:48:15 +08:00
|
|
|
import clearPresentationUploadToken from '/imports/api/presentation-upload-token/server/modifiers/clearPresentationUploadToken';
|
2018-04-06 04:56:41 +08:00
|
|
|
|
2023-03-15 03:50:35 +08:00
|
|
|
export default async function removePresentationPod(meetingId, podId) {
|
2018-04-06 04:56:41 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(podId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
podId,
|
|
|
|
};
|
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-15 03:50:35 +08:00
|
|
|
const numberAffected = await PresentationPods.removeAsync(selector);
|
2018-04-06 04:56:41 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected && podId) {
|
2018-04-06 04:56:41 +08:00
|
|
|
Logger.info(`Removed presentation pod id=${podId} meeting=${meetingId}`);
|
|
|
|
clearPresentations(meetingId, podId);
|
2018-09-20 01:48:15 +08:00
|
|
|
clearPresentationUploadToken(meetingId, podId);
|
2018-04-06 04:56:41 +08:00
|
|
|
}
|
2020-11-25 04:44:13 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on removing presentation pod from collection: ${err}`);
|
|
|
|
}
|
2018-04-06 04:56:41 +08:00
|
|
|
}
|