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

29 lines
699 B
JavaScript

import Meetings from '/imports/api/meetings';
import Logger from '/imports/startup/server/logger';
import { check } from 'meteor/check';
export default async function setPublishedPoll(meetingId, isPublished) {
check(meetingId, String);
check(isPublished, Boolean);
const selector = {
meetingId,
};
const modifier = {
$set: {
publishedPoll: isPublished,
},
};
try {
const { numberAffected } = await Meetings.upsert(selector, modifier);
if (numberAffected) {
Logger.info(`Set publishedPoll=${isPublished} in meeitingId=${meetingId}`);
}
} catch (err) {
Logger.error(`Setting publishedPoll=${isPublished} for meetingId=${meetingId}`);
}
}