Able to view all reviews for a selected course (including reviews for a professor which is related to a course)
Able to filter reviews based on selected professor(s)
For course information component, it will be covered in another PR to keep this PR small and easy to be reviewed
Changes
Mock Data
new review with id s0b1ee9e-6164-4565-890d-45d844593e63 under review.json
change 2 reviews's reviewedProfessorId field to null to reflect course reviews
new review with course and professor labels under review_labels.json
DB Schema
updated schema for course table to make course code unique
Course page
updated middleware.ts to apply middleware to course route
extracted rating calculations part to 2 functions (refer comment) - calculateAverage as a common function and calculateRatingItems as a specific function under review modules
updated reviews, professors and courses api routes to be able to retrieve data for course page from db
Actual implementation for header, rating, and filter components
Implementation
parallel routes on the core sections - @header, @rating, @filter
Pure Course Reviews: These are reviews that only have labels related to the course, such as interesting, practical, and learn new skills.
Professor Reviews: Reviews for professors are always linked to a course. These reviews will include labels related to both the professor and the course.
Context
This PR addresses issue https://github.com/AfterClass-io/afterclass.io-v2/issues/88 and focuses on the integration for course page. Few important functionalities include:
For course information component, it will be covered in another PR to keep this PR small and easy to be reviewed
Changes
Mock Data
s0b1ee9e-6164-4565-890d-45d844593e63
underreview.json
reviewedProfessorId
field tonull
to reflect course reviewsreview_labels.json
DB Schema
Course page
middleware.ts
to apply middleware tocourse
routecalculateAverage
as a common function andcalculateRatingItems
as a specific function under review modulesreviews
,professors
andcourses
api routes to be able to retrieve data for course page from dbImplementation
@header
,@rating
,@filter
Note
Testing
Preview
Unauthenticated
Authenticated
Filtered
Multiple Filtered