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
|
|
|
|
2017-10-12 08:33:57 +08:00
|
|
|
export default function userVoted({ body }, meetingId) {
|
|
|
|
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,
|
|
|
|
answers: [
|
|
|
|
{
|
|
|
|
id: Number,
|
|
|
|
key: String,
|
|
|
|
numVotes: Number,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
numRespondents: Number,
|
|
|
|
numResponders: Number,
|
|
|
|
});
|
2016-10-21 21:21:09 +08:00
|
|
|
|
2017-12-13 00:19:24 +08:00
|
|
|
return updateVotes(poll, meetingId);
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|