diff options
Diffstat (limited to 'models/votes/vote.schema.ts')
-rw-r--r-- | models/votes/vote.schema.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/models/votes/vote.schema.ts b/models/votes/vote.schema.ts new file mode 100644 index 0000000..63ba212 --- /dev/null +++ b/models/votes/vote.schema.ts @@ -0,0 +1,25 @@ +import { Document, Schema, Types } from 'mongoose'; +import { Vote } from 'which-types'; + +export interface VoteSchema extends Document, Omit<Vote, '_id'> { + password: string; +} + +export const voteSchema = new Schema({ + userId: { + 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 }); + |