2022-07-20 01:31:19 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import VoiceUsers from '/imports/api/voice-users';
|
|
|
|
|
2023-03-17 02:37:24 +08:00
|
|
|
export default async function clearVoiceUser(meetingId, intId) {
|
2022-07-20 01:31:19 +08:00
|
|
|
try {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(intId, String);
|
|
|
|
|
2023-03-17 02:37:24 +08:00
|
|
|
const numberAffected = await VoiceUsers.removeAsync({ meetingId, intId });
|
2022-07-20 01:31:19 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Remove voiceUser=${intId} meeting=${meetingId} (clear)`);
|
|
|
|
}
|
|
|
|
|
|
|
|
return numberAffected;
|
|
|
|
} catch (error) {
|
|
|
|
Logger.error(`Error on clearing voiceUser=${intId} meeting=${meetingId}. ${error}`);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|