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

27 lines
533 B
JavaScript
Raw Normal View History

2016-10-21 21:21:09 +08:00
import { check } from 'meteor/check';
2016-10-22 01:42:43 +08:00
import updateVotes from '../modifiers/updateVotes';
2016-10-21 21:21:09 +08:00
export default async function userVoted({ body }, meetingId) {
2017-10-12 08:33:57 +08:00
const { poll } = body;
2016-10-21 21:21:09 +08:00
check(meetingId, String);
check(poll, {
id: String,
questionType: String,
questionText: String,
answers: [
{
id: Number,
key: String,
numVotes: Number,
},
],
numRespondents: Number,
numResponders: Number,
});
2016-10-21 21:21:09 +08:00
const result = await updateVotes(poll, meetingId);
return result;
2017-06-03 03:25:02 +08:00
}