2021-05-27 03:09:25 +08:00
|
|
|
import { ExternalVideoMeetings } from '/imports/api/meetings';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2023-03-14 00:59:52 +08:00
|
|
|
export default async function clearExternalVideoMeeting(meetingId) {
|
2021-05-27 03:09:25 +08:00
|
|
|
if (meetingId) {
|
|
|
|
try {
|
2023-03-14 00:59:52 +08:00
|
|
|
const numberAffected = await ExternalVideoMeetings.removeAsync({ meetingId });
|
2021-05-27 03:09:25 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared ExternalVideoMeetings in (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing ExternalVideoMeetings in (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2023-03-14 00:59:52 +08:00
|
|
|
const numberAffected = await ExternalVideoMeetings.removeAsync({});
|
2021-05-27 03:09:25 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared ExternalVideoMeetings in all meetings');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing ExternalVideoMeetings in all meetings. ${err}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|