Feature: Implement course rating system#87
Open
charlottenguyen05 wants to merge 3 commits intotarinagarwal:mainfrom
Open
Feature: Implement course rating system#87charlottenguyen05 wants to merge 3 commits intotarinagarwal:mainfrom
charlottenguyen05 wants to merge 3 commits intotarinagarwal:mainfrom
Conversation
Owner
|
@charlottenguyen05 ill review it asap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Frontend Changes
client/src/components/ui/Star.tsx (New File): Created reusable Star component
client/src/components/ui/StarRating.tsx (New File)
client/src/components/courses/CoursesPage.tsx
client/src/components/courses/CourseDetailPage.tsx
rating,averageRating,ratingCount)handleRatingSubmit()function with validationfetchUserRating()to load existing user ratingsclient/src/types/index.ts
average_rating: numberandrating_count: numbertoCourseinterfaceclient/src/utils/api.ts
rateCourse()API function to submit/update ratingsgetCourseRatings()API function to fetch ratings dataBackend Changes
server/prisma/schema.prisma
CourseRatingmodel with fields:id: Unique identifiercourseId: Reference to courseuserId: Reference to userrating: Integer value (1-5)server/routes/courses.js
average_ratingandrating_countfor each course (conform to the new interface of Course in index.ts)average_ratingandrating_countfor the course with that id (conform to the new interface of Course in index.ts)Documentation Changes
docs/API.md: Added documentation for
GET /api/courses/:id/rateendpoint andPOST /api/courses/:id/rateendpoint🔗 Related Issue
Closes #5
🏷️ Type of Change
📸 Screenshots (if applicable)
Video demo (this video is done before I swapped the position of sharing button and rating in header in the last commit):
cinnamon-2026-01-05T185512+0100.webm
cinnamon-2026-01-05T185402+0100.webm
✅ Checklist
🧪 Testing
📋 Additional Notes
I'm SWOC 2026 participant. Can you add the label to this PR for me. Thank you so much.
SWOC 2026 Participant? Add
swoc2026label to your PR! 🎉