-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from mpriyadarshini/master
Day 5
- Loading branch information
Showing
3 changed files
with
150 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const mongoose = require("mongoose"); | ||
const Schema = mongoose.Schema; | ||
|
||
const QuestionSchema = new Schema({ | ||
name: { | ||
type: String, | ||
required: true | ||
}, | ||
text: { | ||
type: String, | ||
required: true | ||
}, | ||
user: { | ||
type: Schema.Types.ObjectId, | ||
ref: "User" | ||
}, | ||
|
||
answers: [ | ||
{ | ||
name: { | ||
type: String, | ||
required: true | ||
}, | ||
text: { | ||
type: String, | ||
required: true | ||
}, | ||
votes: { | ||
type: Number, | ||
default: 0, | ||
required: true | ||
} | ||
} | ||
] | ||
}); | ||
module.exports = Question = mongoose.model("Question", QuestionSchema); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,10 @@ | |
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"author": "Megha Priyadarshini <[email protected]>", | ||
"license": "ISC", | ||
"dependencies": { | ||
"bcrypt": "^3.0.6", | ||
|