Added poll create route in backend✔️
This commit is contained in:
29
backend/src/models/poll.model.js
Normal file
29
backend/src/models/poll.model.js
Normal file
@@ -0,0 +1,29 @@
|
||||
import mongoose, { Schema } from "mongoose";
|
||||
|
||||
const pollSchema = new Schema({
|
||||
title : {
|
||||
type : String,
|
||||
required : true,
|
||||
trim : true
|
||||
},
|
||||
description : {
|
||||
type : String,
|
||||
required : true,
|
||||
trim : true
|
||||
},
|
||||
creatorId : {
|
||||
type : Schema.Types.ObjectId,
|
||||
ref : "User",
|
||||
required : true
|
||||
},
|
||||
options : [
|
||||
{
|
||||
type : Object,
|
||||
required : true,
|
||||
}
|
||||
]
|
||||
}, {timestamps : true});
|
||||
|
||||
|
||||
const PollModel = mongoose.model("Poll", pollSchema);
|
||||
export default PollModel;
|
||||
Reference in New Issue
Block a user