2018-03-10 02:42:14 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import GroupChatMsg from '/imports/api/group-chat-msg';
|
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
export default async function removeGroupChatMsg(meetingId, chatId) {
|
2018-03-10 02:42:14 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(chatId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
chatId,
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-04-01 04:40:41 +08:00
|
|
|
const numberAffected = await GroupChatMsg.removeAsync(selector);
|
2018-03-10 02:42:14 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
2018-03-10 02:42:14 +08:00
|
|
|
Logger.info(`Removed group-chat-msg id=${chatId} meeting=${meetingId}`);
|
|
|
|
}
|
2020-11-25 04:44:13 +08:00
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Removing group-chat-msg from collection: ${err}`);
|
|
|
|
}
|
2018-03-10 02:42:14 +08:00
|
|
|
}
|