bigbluebutton-Github/bigbluebutton-html5/imports/api/polls/server/modifiers/clearPolls.js

27 lines
683 B
JavaScript
Raw Normal View History

import Polls from '/imports/api/polls';
import Logger from '/imports/startup/server/logger';
2016-05-13 01:43:59 +08:00
export default async function clearPolls(meetingId) {
if (meetingId) {
try {
const numberAffected = await Polls.removeAsync({ meetingId });
if (numberAffected) {
Logger.info(`Cleared Polls (${meetingId})`);
}
} catch (err) {
Logger.info(`Error on clearing Polls (${meetingId}). ${err}`);
}
} else {
try {
const numberAffected = await Polls.removeAsync({});
2016-10-22 01:42:43 +08:00
if (numberAffected) {
Logger.info('Cleared Polls (all)');
}
} catch (err) {
Logger.info(`Error on clearing Polls (all). ${err}`);
}
}
2017-06-03 03:25:02 +08:00
}