2018-09-20 01:48:15 +08:00
|
|
|
import PresentationUploadToken from '/imports/api/presentation-upload-token';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export default function clearPresentationUploadToken(meetingId, podId) {
|
|
|
|
if (meetingId && podId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = PresentationUploadToken.remove({ meetingId, podId });
|
|
|
|
|
|
|
|
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 {
|
|
|
|
const numberAffected = PresentationUploadToken.remove({ 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
|
|
|
|
const numberAffected = PresentationUploadToken.remove({});
|
|
|
|
|
|
|
|
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
|
|
|
}
|