2018-09-20 01:48:15 +08:00
|
|
|
import PresentationUploadToken from '/imports/api/presentation-upload-token';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2023-03-17 01:47:55 +08:00
|
|
|
export default async function clearPresentationUploadToken(
|
|
|
|
meetingId,
|
|
|
|
podId,
|
|
|
|
) {
|
2018-09-20 01:48:15 +08:00
|
|
|
if (meetingId && podId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-17 01:47:55 +08:00
|
|
|
const numberAffected = await PresentationUploadToken.removeAsync({ meetingId, podId });
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared Presentations Upload Token (${meetingId}, ${podId})`);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing Presentations Upload Token (${meetingId}, ${podId}). ${err}`);
|
|
|
|
return false;
|
|
|
|
}
|
2018-09-20 01:48:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-17 01:47:55 +08:00
|
|
|
const numberAffected = await PresentationUploadToken.removeAsync({ meetingId });
|
2018-09-20 01:48:15 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared Presentations Upload Token (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing Presentations Upload Token (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
// clearing presentations for the whole server
|
2023-03-17 01:47:55 +08:00
|
|
|
const numberAffected = await PresentationUploadToken.removeAsync({});
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared Presentations Upload Token (all)');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing Presentations Upload Token (all). ${err}`);
|
|
|
|
}
|
|
|
|
}
|
2018-09-20 01:48:15 +08:00
|
|
|
}
|