blob: 6f3d088882d269f27f564cb6bfe067d0a34f6154 (
plain)
1
2
3
4
5
6
7
8
9
10
|
import { Model, model } from 'mongoose';
import { PollSchema, pollSchema } from './poll.schema';
pollSchema.methods.vote = function(userId: string, which: 'left' | 'right'): PollSchema {
this.contents[which].votes.push(userId);
return this.save();
}
export default model<PollSchema, Model<PollSchema>>('Poll', pollSchema);
|