bigbluebutton-Github/bigbluebutton-html5/imports/api/polls/server/handlers/pollStarted.js

23 lines
614 B
JavaScript
Raw Normal View History

2016-10-21 21:21:09 +08:00
import { check } from 'meteor/check';
import addPoll from '../modifiers/addPoll';
import setPublishedPoll from '../../../meetings/server/modifiers/setPublishedPoll';
2016-10-21 21:21:09 +08:00
export default async function pollStarted({ body }, meetingId) {
const {
userId, poll, pollType, secretPoll, question,
} = body;
2016-10-21 21:21:09 +08:00
check(meetingId, String);
2017-10-12 08:33:57 +08:00
check(userId, String);
2016-10-21 21:21:09 +08:00
check(poll, Object);
check(pollType, String);
check(secretPoll, Boolean);
check(question, String);
2016-10-21 21:21:09 +08:00
setPublishedPoll(meetingId, false);
const result = await addPoll(meetingId, userId, poll, pollType, secretPoll, question);
return result;
2016-10-21 21:21:09 +08:00
}