blob: 3220ee7af83d36c5642674f30520702da61f9892 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import PollModel from '../../models/polls/poll.model';
import { PollSchema } from '../../models/polls/poll.schema';
export default class Votes {
async create(data: any, params: any): Promise<PollSchema | null> {
const poll = await PollModel.findById(params.route.id);
if (poll) {
const updatedPoll = await poll.vote(params.user._id, data.which);
return updatedPoll.toObject();
}
return null;
}
}
|