-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcourse.js
More file actions
64 lines (61 loc) · 2.13 KB
/
course.js
File metadata and controls
64 lines (61 loc) · 2.13 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
53
54
55
56
57
58
59
60
61
62
63
64
const mongoose = require("mongoose");
const { announcement, announcementSchema } = require("./announcement");
const { Schema } = mongoose;
const { courseCoupenSchema } = require("./courseCoupen");
const { lecture } = require("./lecture");
const { studentSchema } = require("./student");
const courseSchema = new Schema(
{
title: { type: String, required: true },
subTitle: { type: String, required: true },
rating: { type: Number, default: 0 },
language: String,
autoGeneratedLanguage: [String],
totalSection: Number,
totalLecture: Number,
totalQuiz: Number,
totalTime: Schema.Types.Decimal128,
cost: Schema.Types.Decimal128,
totalEnroolment: { type: Number, default: 0 },
creator: {
name: String,
authorId: { type: Schema.Types.ObjectId, ref: "creator", required: true },
},
position: [Schema.Types.ObjectId ],//here we are saving section position
subAuthorDetails: {
title: { type: String, maxlength: 100 },
description: { type: String, maxlength: 500 },
socialMediaHandles: { type: Map, of: String },
},
leaningPoints: [
{
title: { type: String, maxlength: 100 },
description: { type: String, maxlength: 500 },
},
],
sections: [{ type: Schema.Types.ObjectId, ref: "section" }],
reviewCount: Number,
coupnes: [courseCoupenSchema],
courseLearning: [String],
prerequisites: [String],
couseAttraction: [String],
heighlightedReview: [courseCoupenSchema],
courseImage: String,
promotionalVideo: String,
courseDescription: String,
idDeleted: { type: Boolean, default: false },
isActive: { type: Boolean, default: true },
welcomeMessage: { type: String, required: false },
congressMessage: { type: String, required: false },
announcements: [{ type: Schema.Types.ObjectId, ref: "annoucment" }],
demo: [
{
lectureId: { type: Schema.Types.ObjectId, ref: lecture },
description: { type: String, maxlength: 100, required: true },
},
],
},
{ timestamps: true }
);
const course = mongoose.model("course", courseSchema);
module.exports = { courseSchema, course };