2019-08-01 03:10:41 +08:00
|
|
|
import { Slides, SlidePositions } from '/imports/api/slides';
|
2016-10-21 19:41:17 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2016-05-13 01:43:59 +08:00
|
|
|
|
2023-03-16 01:35:25 +08:00
|
|
|
export default async function clearSlides(meetingId) {
|
2016-10-21 19:41:17 +08:00
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-16 01:35:25 +08:00
|
|
|
const numberAffectedSlidePositions = await SlidePositions.removeAsync({ meetingId });
|
2019-08-01 03:10:41 +08:00
|
|
|
|
2023-03-16 01:35:25 +08:00
|
|
|
const numberAffected = await Slides.removeAsync({ meetingId });
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffectedSlidePositions) {
|
|
|
|
Logger.info(`Cleared SlidePositions (${meetingId})`);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared Slides (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on cleaning Slides (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2023-03-16 01:35:25 +08:00
|
|
|
const numberAffectedSlidePositions = await SlidePositions.removeAsync({ meetingId });
|
2016-11-18 20:28:55 +08:00
|
|
|
|
2023-03-16 01:35:25 +08:00
|
|
|
const numberAffected = await Slides.removeAsync({ meetingId });
|
2019-08-01 03:10:41 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffectedSlidePositions) {
|
|
|
|
Logger.info(`Cleared SlidePositions (${meetingId})`);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared Slides (all)');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on cleaning Slides (all). ${err}`);
|
|
|
|
}
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|