2019-05-22 22:44:17 +08:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-25 21:54:18 +08:00
|
|
|
try {
|
|
|
|
const { numberAffected } = Meetings.upsert(selector, modifier);
|
2019-05-22 22:44:17 +08:00
|
|
|
|
2020-11-25 21:54:18 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Set publishedPoll=${isPublished} in meeitingId=${meetingId}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Setting publishedPoll=${isPublished} for meetingId=${meetingId}`);
|
|
|
|
}
|
2019-05-22 22:44:17 +08:00
|
|
|
}
|