Conversation
|
Your Render PR Server URL is https://ucredit-dev-pr-90.onrender.com. Follow its progress at https://dashboard.render.com/web/srv-ch1kgfhmbg57g9rj1bbg. |
mpark63
left a comment
There was a problem hiding this comment.
gj rosa! requested some changes, lmk what you think!
Also, please making a corresponding PR in frontend that uses this new route.
There was a problem hiding this comment.
This file should not be in the PR? :?
For clean files changed history, please make a fresh branch from dev and add your update course changes
There was a problem hiding this comment.
same as above, this file hsould not be in the PR
routes/course.js
Outdated
| for (let id of course.distribution_ids) { | ||
| const distribution = await Distributions | ||
| .findByIdAndUpdate( | ||
| id, | ||
| { $pull: { courses: c_id } }, | ||
| { new: true, runValidators: true } | ||
| ) | ||
| .exec(); | ||
| await distributionCreditUpdate(distribution, course, false); | ||
| } |
There was a problem hiding this comment.
please remove this code, as Distributions are unused at this point in time
routes/course.js
Outdated
| for (const existingCourse of retrievedCourses) { | ||
| if(existingCourse.number === course.number && existingCourse.term === course.term && existingCourse.year === course.year && existingCourse.title === course.title){ | ||
| return errorHandler(res, 400, { | ||
| message: "Cannot take same course multiple times in the same semester", | ||
| }); | ||
| } | ||
| } |
There was a problem hiding this comment.
I think this would not be necessary as hopefully there were no duplicate courses to begin with.
but maybe that's not a correct assumption.
I'll leave it up to you!
routes/course.js
Outdated
| course.distribution_ids.forEach((id) => { | ||
| if (!plan.distribution_ids.includes(id)) | ||
| errorHandler(res, 500, { | ||
| message: "Invalid combination of plan_id and distribution_ids.", | ||
| }); | ||
| }); |
|
|
||
|
|
||
|
|
||
| describe("Course Routes: PATCH /api/courses/:course_id", () => { |
Added PATCH /api/courses/:course_id which takes in a course id as param and a new course as req body for deleting the old course and adding the new course