bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/setPublishedPoll.js
2019-05-23 14:16:52 +00:00

29 lines
680 B
JavaScript

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