ADD file via upload

main
phgkfux43 4 months ago
parent e8a0fc873c
commit 89fc676550

@ -0,0 +1,49 @@
const mongoose = require('mongoose');
const answerSchema = new mongoose.Schema({
questionId: {
type: mongoose.Schema.Types.ObjectId,
required: true
},
userAnswer: mongoose.Schema.Types.Mixed,
isCorrect: {
type: Boolean,
required: true
},
score: {
type: Number,
required: true
}
});
const resultSchema = new mongoose.Schema({
exam: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Exam',
required: true
},
user: {
type: mongoose.Schema.Types.ObjectId,
ref: 'User',
required: true
},
answers: [answerSchema],
totalScore: {
type: Number,
required: true
},
maxScore: {
type: Number,
required: true
},
timeTaken: { // 用时(秒)
type: Number,
required: true
},
submittedAt: {
type: Date,
default: Date.now
}
});
module.exports = mongoose.model('Result', resultSchema);
Loading…
Cancel
Save