diff options
Diffstat (limited to 'models/votes/vote.schema.ts')
-rw-r--r-- | models/votes/vote.schema.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/models/votes/vote.schema.ts b/models/votes/vote.schema.ts index 709e8bf..63ba212 100644 --- a/models/votes/vote.schema.ts +++ b/models/votes/vote.schema.ts @@ -8,15 +8,18 @@ export interface VoteSchema extends Document, Omit<Vote, '_id'> { export const voteSchema = new Schema({ userId: { type: Types.ObjectId, - ref: 'user' + ref: 'user', + required: true }, pollId: { type: Types.ObjectId, - ref: 'poll' + ref: 'poll', + required: true }, which: { type: String, - enum: ['left', 'right'] + enum: ['left', 'right'], + required: true } }, { timestamps: true }); |