2018-03-10 02:42:14 +08:00
|
|
|
import GroupChat from '/imports/api/group-chat';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2018-08-06 20:05:07 +08:00
|
|
|
import clearGroupChatMsg from '/imports/api/group-chat-msg/server/modifiers/clearGroupChatMsg';
|
2018-03-10 02:42:14 +08:00
|
|
|
|
2023-03-16 21:03:29 +08:00
|
|
|
export default async function clearGroupChat(meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-16 21:03:29 +08:00
|
|
|
await clearGroupChatMsg(meetingId);
|
|
|
|
const numberAffected = await GroupChat.removeAsync({ meetingId });
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared GroupChat (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing GroupChat (${meetingId}). ${err}`);
|
|
|
|
}
|
2018-03-10 02:42:14 +08:00
|
|
|
}
|