bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/methods/clearRandomlySelectedUser.js
2023-03-20 16:24:41 -03:00

31 lines
886 B
JavaScript

import Logger from '/imports/startup/server/logger';
import Meetings from '/imports/api/meetings';
import { extractCredentials } from '/imports/api/common/server/helpers';
import { check } from 'meteor/check';
export default async function clearRandomlySelectedUser() {
try {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);
const selector = {
meetingId,
};
const modifier = {
$set: {
randomlySelectedUser: [],
},
};
const numberAffected = await Meetings.updateAsync(selector, modifier);
if (numberAffected) {
Logger.info(`Cleared randomly selected user from meeting=${meetingId} by id=${requesterUserId}`);
}
} catch (err) {
Logger.error(`Exception while invoking method clearRandomlySelectedUser ${err.stack}`);
}
}