2016-10-21 21:21:09 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import addPoll from '../modifiers/addPoll';
|
2019-05-22 22:44:17 +08:00
|
|
|
import setPublishedPoll from '../../../meetings/server/modifiers/setPublishedPoll';
|
2016-10-21 21:21:09 +08:00
|
|
|
|
2023-03-07 21:47:43 +08:00
|
|
|
export default async function pollStarted({ body }, meetingId) {
|
2020-09-21 20:07:36 +08:00
|
|
|
const {
|
2021-04-29 23:10:18 +08:00
|
|
|
userId, poll, pollType, secretPoll, question,
|
2020-09-21 20:07:36 +08:00
|
|
|
} = 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);
|
2020-09-21 20:07:36 +08:00
|
|
|
check(pollType, String);
|
2021-04-29 23:10:18 +08:00
|
|
|
check(secretPoll, Boolean);
|
2020-09-21 20:07:36 +08:00
|
|
|
check(question, String);
|
2016-10-21 21:21:09 +08:00
|
|
|
|
2019-05-22 22:44:17 +08:00
|
|
|
setPublishedPoll(meetingId, false);
|
|
|
|
|
2023-03-07 21:47:43 +08:00
|
|
|
const result = await addPoll(meetingId, userId, poll, pollType, secretPoll, question);
|
|
|
|
|
|
|
|
return result;
|
2016-10-21 21:21:09 +08:00
|
|
|
}
|