-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoursePerformance.js
More file actions
52 lines (48 loc) · 1.29 KB
/
coursePerformance.js
File metadata and controls
52 lines (48 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const mongoose = require("mongoose");
const { Schema } = mongoose;
const courscPerformanceKindSchema = new Schema(
{
lectureId: { type: Schema.Types.ObjectId, index: true, required: true },
studentId: {
type: Schema.Types.ObjectId,
ref: "student",
index: true,
required: true,
},
courseId: {
type: Schema.Types.ObjectId,
ref: "course",
index: true,
required: true,
},
completed: Boolean,
},
{ discriminatorKey: "kind" }
);
const performaceKind = mongoose.model("coursePerformance", performanceKindSchema);
const assignmentPerformance= new Schema({
subcomment: {
parent: Schema.Types.ObjectId,
index: { type: Number, min: 1, requied: true },
},
questionId: { type: Schema.Types.ObjectId, required: true },
asnwer: { type: String, required: true, maxlength: 1000 },
})
performaceKind.discriminator(
"assignment",
assignmentPerformance
);
performaceKind.discriminator(
"quiz",
new Schema({
attemp: Number,
combined: {
questionId: { type: Schema.Types.ObjectId, required: true },
answer: [Schema.Types.ObjectId],
},
correct: Boolean,
attemp: Boolean,
})
);
const mode=assignmentPerformance.
module.exports= { performaceKind, courscPerformanceKindSchema,assignmentPerformance.Mp };