Added vote route in backend

This commit is contained in:
Manik Maity
2024-11-12 19:47:58 +05:30
parent c61fe265a5
commit 451a57c438
8 changed files with 173 additions and 28 deletions

View File

@@ -0,0 +1,23 @@
import mongoose, { Schema } from "mongoose";
const voteSchema = new Schema({
pollId : {
type : Schema.Types.ObjectId,
ref : "Poll",
required : true
},
userId : {
type : Schema.Types.ObjectId,
ref : "User",
required : true
},
optionId : {
type : Schema.Types.ObjectId,
ref : "Option",
required : true
},
}, {timestamps : true});
const VoteModel = mongoose.model("Vote", voteSchema);
export default VoteModel;