-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsectionAssignment.js
More file actions
42 lines (40 loc) · 1.15 KB
/
sectionAssignment.js
File metadata and controls
42 lines (40 loc) · 1.15 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
const mongoose = require("mongoose");
const { Schema } = mongoose;
const sectionAssignmentSchema = new Schema(
{
basicInfo: {
title: { type: String, required: true, maxlength: 100 },
description: { type: String, required: true, maxlength: 300 },
extimateDuration: { type: Number, required: true, min: 1 },
},
type: { type: String, default: 'assignment' },
instructions: {
type: new Schema({
videoPath: { type: String },
instruction: { type: String, required: true },
resourcePath: { type: String },
}),
required: false,
default: undefined,
},
questions: [
new Schema(
{
question: { type: String, required: true, maxlength: 1000 },
},
{ timestamps: true }
),
],
Solution: new Schema({
videoPath: { type: String },
resourcePath: { type: String },
}),
sectionId: { type: Schema.Types.ObjectId, ref: "section", index: true },
},
{ timestamps: true }
);
const sectionAssignment = mongoose.model(
"sectionAssignment",
sectionAssignmentSchema
);
module.exports = { sectionAssignmentSchema, sectionAssignment };