bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/clearExternalVideoMeeting.js
2023-03-20 16:24:41 -03:00

27 lines
844 B
JavaScript

import { ExternalVideoMeetings } from '/imports/api/meetings';
import Logger from '/imports/startup/server/logger';
export default async function clearExternalVideoMeeting(meetingId) {
if (meetingId) {
try {
const numberAffected = await ExternalVideoMeetings.removeAsync({ meetingId });
if (numberAffected) {
Logger.info(`Cleared ExternalVideoMeetings in (${meetingId})`);
}
} catch (err) {
Logger.info(`Error on clearing ExternalVideoMeetings in (${meetingId}). ${err}`);
}
} else {
try {
const numberAffected = await ExternalVideoMeetings.removeAsync({});
if (numberAffected) {
Logger.info('Cleared ExternalVideoMeetings in all meetings');
}
} catch (err) {
Logger.error(`Error on clearing ExternalVideoMeetings in all meetings. ${err}`);
}
}
}