diff --git a/models/category.js b/models/category.js index 8cbd1e1..b9e93c8 100644 --- a/models/category.js +++ b/models/category.js @@ -4,14 +4,14 @@ const categorySchema = new mongoose.Schema({ name: { type: String, required: true, - // unique: true, + unique: true, }, - courses: + courses: [ { type: mongoose.Schema.Types.ObjectId, ref: "Course", }, - + ], }); const Category = new mongoose.model("Category", categorySchema); module.exports = Category; diff --git a/models/course.js b/models/course.js index 5807f9b..488537d 100644 --- a/models/course.js +++ b/models/course.js @@ -1,6 +1,6 @@ const mongoose = require("mongoose"); -// const reviewSchema = require("./review"); +const reviewSchema = require("./review"); const courseSchema = new mongoose.Schema( { title: { @@ -20,17 +20,17 @@ const courseSchema = new mongoose.Schema( ref: "User", }, - // videos: [ - // { - // video: { - // type: mongoose.Schema.Types.ObjectId, - // ref: "Video", - // }, - // note: { - // type: String, - // }, - // }, - // ], + videos: [ + { + video: { + type: mongoose.Schema.Types.ObjectId, + ref: "Video", + }, + note: { + type: String, + }, + }, + ], category: { type: String, @@ -72,7 +72,7 @@ const courseSchema = new mongoose.Schema( type: Boolean, default: false, }, - // reviews: [reviewSchema], + reviews: [reviewSchema], weightedRating: { type: Number, default: 0,