2021-02-09 20:30:09 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user';
|
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
export default async function clearWhiteboardMultiUser(meetingId) {
|
2021-02-09 20:30:09 +08:00
|
|
|
if (meetingId) {
|
|
|
|
try {
|
2023-04-01 04:40:41 +08:00
|
|
|
const numberAffected = WhiteboardMultiUser.removeAsync({ meetingId });
|
2021-02-09 20:30:09 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared WhiteboardMultiUser (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error clearing WhiteboardMultiUser (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2023-04-01 04:40:41 +08:00
|
|
|
const numberAffected = await WhiteboardMultiUser.removeAsync({});
|
2021-02-09 20:30:09 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared WhiteboardMultiUser (all)');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error clearing WhiteboardMultiUser (all). ${err}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|