blob: 72b196d26beec610f4a5d943bf3a3e113516123b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { Document, Schema, Types } from 'mongoose';
import { Vote } from 'which-types';
export interface VoteSchema extends Document, Omit<Vote, '_id'> {}
export const voteSchema = new Schema({
authorId: {
type: Types.ObjectId,
ref: 'user',
required: true
},
pollId: {
type: Types.ObjectId,
ref: 'poll',
required: true
},
which: {
type: String,
enum: ['left', 'right'],
required: true
}
}, { timestamps: true });
|