2021-02-09 20:30:09 +08:00
|
|
|
import GuestUsers from '/imports/api/guest-users';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2023-03-09 01:35:40 +08:00
|
|
|
export default async function clearGuestUsers(meetingId) {
|
2021-02-09 20:30:09 +08:00
|
|
|
if (meetingId) {
|
|
|
|
try {
|
2023-03-09 01:35:40 +08:00
|
|
|
const numberAffected = await GuestUsers.removeAsync({ meetingId });
|
2021-02-09 20:30:09 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared GuestUsers in (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing GuestUsers in (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2023-03-09 01:35:40 +08:00
|
|
|
const numberAffected = await GuestUsers.removeAsync({});
|
2021-02-09 20:30:09 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared GuestUsers in all meetings');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing GuestUsers in all meetings. ${err}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|