7f926edfcc
Refactor the external videos collection, moving the logic and functionalities outside of /imports/api/meetings to a new location in /external-videos/server/modifiers in order to decrease the coupling between the functionalities, favoring the maintenance.
27 lines
816 B
JavaScript
27 lines
816 B
JavaScript
import { ExternalVideoMeetings } from '/imports/api/meetings';
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
export default function clearExternalVideoMeeting(meetingId) {
|
|
if (meetingId) {
|
|
try {
|
|
const numberAffected = ExternalVideoMeetings.remove({ meetingId });
|
|
|
|
if (numberAffected) {
|
|
Logger.info(`Cleared ExternalVideoMeetings in (${meetingId})`);
|
|
}
|
|
} catch (err) {
|
|
Logger.info(`Error on clearing ExternalVideoMeetings in (${meetingId}). ${err}`);
|
|
}
|
|
} else {
|
|
try {
|
|
const numberAffected = ExternalVideoMeetings.remove({});
|
|
|
|
if (numberAffected) {
|
|
Logger.info('Cleared ExternalVideoMeetings in all meetings');
|
|
}
|
|
} catch (err) {
|
|
Logger.error(`Error on clearing ExternalVideoMeetings in all meetings. ${err}`);
|
|
}
|
|
}
|
|
}
|