diff options
Diffstat (limited to 'models/votes/vote.model.ts')
-rw-r--r-- | models/votes/vote.model.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/models/votes/vote.model.ts b/models/votes/vote.model.ts new file mode 100644 index 0000000..df2307e --- /dev/null +++ b/models/votes/vote.model.ts @@ -0,0 +1,7 @@ +import { Model, model } from 'mongoose'; +import { VoteSchema, voteSchema } from './vote.schema'; + +voteSchema.index({ pollId: 1, userId: 1 }, { unique: true }); // Unique together + +export default model<VoteSchema, Model<VoteSchema>>('Vote', voteSchema); + |