blob: d95c1489e58f420ee1385912346d8693fa787823 (
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> {
return PollModel.findById(params.route.id)
.then(poll => poll?.vote(params.user._id, data.which))
.catch(e => {
console.error(e);
return null;
});
}
}
|