diff --git a/server/controllers/Course.js b/server/controllers/Course.js index 78fa21b..dcba816 100644 --- a/server/controllers/Course.js +++ b/server/controllers/Course.js @@ -425,8 +425,10 @@ exports.getInstructorCourses = async (req, res) => { // Delete the Course exports.deleteCourse = async (req, res) => { try { - const { categoryId, courseId } = req.body - + const {courseId } = req.body + + console.log("Course Id -> ", courseId) + // Find the course const course = await Course.findById(courseId) console.log("Course -> ", course) @@ -442,7 +444,20 @@ exports.deleteCourse = async (req, res) => { $pull: { courses: courseId }, }) } - + + //delete the entry of this course from the course list of instructor + const courseInstructorId = course.instructor + const updatedCourseList = await User.findByIdAndUpdate(courseInstructorId, + { + $pull: { + courses: courseId + } + }, + {new: true}) + .populate("courses") + .exec() + console.log("Updated courses list -> ", updatedCourseList) + // Delete sections and sub-sections const courseSections = course.courseContent console.log("Course Section -> ", courseSections) @@ -464,14 +479,12 @@ exports.deleteCourse = async (req, res) => { // Delete the section await Section.findByIdAndDelete(sectionId) } - - // Delete the course - await Course.findByIdAndDelete(courseId) //TODO: Update the category schema..i.e.. //we have to delete the course from the courses array of category model + const categoryId = course.category const updatedCategory = await Category.findByIdAndUpdate( - {_id: categoryId}, + categoryId, { $pull: { courses: courseId, @@ -480,6 +493,12 @@ exports.deleteCourse = async (req, res) => { {new: true}) .populate("courses") .exec() + + console.log("Category Id -> ", categoryId) + console.log("Upated category details -> ", updatedCategory) + + // Delete the course + await Course.findByIdAndDelete(courseId) return res.status(200).json({ success: true, diff --git a/server/mail/templates/contactFormRes.js b/server/mail/templates/contactFormRes.js index 5f6f8e2..0479fe8 100644 --- a/server/mail/templates/contactFormRes.js +++ b/server/mail/templates/contactFormRes.js @@ -74,8 +74,7 @@ exports.contactUsEmail = (
- +
Contact Form Confirmation

Dear ${firstname} ${lastname},

diff --git a/server/mail/templates/courseEnrollmentEmail.js b/server/mail/templates/courseEnrollmentEmail.js index fa88264..3549858 100644 --- a/server/mail/templates/courseEnrollmentEmail.js +++ b/server/mail/templates/courseEnrollmentEmail.js @@ -67,8 +67,7 @@ exports.courseEnrollmentEmail = (courseName, name) => {
- +
Course Registration Confirmation

Dear ${name},

diff --git a/server/mail/templates/emailVerificationTemplate.js b/server/mail/templates/emailVerificationTemplate.js index ce825cd..777be84 100644 --- a/server/mail/templates/emailVerificationTemplate.js +++ b/server/mail/templates/emailVerificationTemplate.js @@ -66,8 +66,7 @@ const otpTemplate = (otp) => {
- +
OTP Verification Email

Dear User,

diff --git a/server/mail/templates/passwordUpdate.js b/server/mail/templates/passwordUpdate.js index 85dbf8d..36e5d16 100644 --- a/server/mail/templates/passwordUpdate.js +++ b/server/mail/templates/passwordUpdate.js @@ -55,8 +55,7 @@ exports.passwordUpdated = (email, name) => {
- +
Password Update Confirmation

Hey ${name},

diff --git a/server/mail/templates/paymentSuccessEmail.js b/server/mail/templates/paymentSuccessEmail.js index 3b0b43d..304d52a 100644 --- a/server/mail/templates/paymentSuccessEmail.js +++ b/server/mail/templates/paymentSuccessEmail.js @@ -67,8 +67,7 @@ exports.paymentSuccessEmail = (name, amount, orderId, paymentId) => {
- +
Course Payment Confirmation

Dear ${name},

@@ -77,7 +76,7 @@ exports.paymentSuccessEmail = (name, amount, orderId, paymentId) => {

Your Order ID is ${orderId}

If you have any questions or need assistance, please feel free to reach out to us at info@codeholic.com. We are here to help!
+ href="mailto:info@codeholic.com">info@codeholic.com. We are here to help!
diff --git a/src/components/core/Dashboard/AddCourse/CourseInformation/CourseInformationForm.jsx b/src/components/core/Dashboard/AddCourse/CourseInformation/CourseInformationForm.jsx index fb60f13..7277112 100644 --- a/src/components/core/Dashboard/AddCourse/CourseInformation/CourseInformationForm.jsx +++ b/src/components/core/Dashboard/AddCourse/CourseInformation/CourseInformationForm.jsx @@ -226,7 +226,7 @@ const CourseInformationForm = () => { }} className='w-full rounded-[0.5rem] bg-richblack-800 p-[12px] text-richblack-5' /> - + {/* */}
{errors.coursePrice && ( diff --git a/src/components/core/Dashboard/MyCourses.jsx b/src/components/core/Dashboard/MyCourses.jsx index 3ac0c57..eda624a 100644 --- a/src/components/core/Dashboard/MyCourses.jsx +++ b/src/components/core/Dashboard/MyCourses.jsx @@ -28,7 +28,7 @@ const MyCourses = () => {

My Courses

navigate("/dashboard/add-course")} + onClick={() => navigate("/dashboard/add-course")} > diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx index 04553a2..53e02a8 100644 --- a/src/pages/Signup.jsx +++ b/src/pages/Signup.jsx @@ -5,7 +5,7 @@ import signupImg from "../assets/Images/signup.webp" const Signup = () => { return (