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
|
|
|
|
2023-03-07 21:47:43 +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);
|
2017-12-13 00:19:24 +08:00
|
|
|
check(poll, {
|
|
|
|
id: String,
|
2021-06-12 00:55:53 +08:00
|
|
|
questionType: String,
|
2021-05-28 05:04:15 +08:00
|
|
|
questionText: String,
|
2017-12-13 00:19:24 +08:00
|
|
|
answers: [
|
|
|
|
{
|
|
|
|
id: Number,
|
|
|
|
key: String,
|
|
|
|
numVotes: Number,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
numRespondents: Number,
|
|
|
|
numResponders: Number,
|
|
|
|
});
|
2016-10-21 21:21:09 +08:00
|
|
|
|
2023-03-07 21:47:43 +08:00
|
|
|
const result = await updateVotes(poll, meetingId);
|
|
|
|
|
|
|
|
return result;
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|