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