-
Notifications
You must be signed in to change notification settings - Fork 17
Add all necessary endpoints for review system #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a comprehensive review system for locations, including both star ratings and tag-based reviews. The implementation includes new database tables, API endpoints, and comprehensive test coverage. The PR also refactors the server code by organizing endpoints into separate modules and renames some types for better clarity.
Changes:
- Added complete review system with star ratings (0.5-5.0 scale) and tag-based reviews with upvote/downvote and optional text
- Refactored server endpoints into modular files (auth, deprecated, misc, reviews)
- Renamed types for consistency:
IParsedTimeRange→ITimeSlot,ITimeRangeInternal→IDateTimeRange
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/reviews.test.ts | Comprehensive test suite for review functionality including edge cases |
| src/utils/timeUtils.ts | Updated type reference from ITimeRangeInternal to IDateTimeRange |
| src/server.ts | Refactored to use modular endpoint files and added API description |
| src/env.ts | Added optional HARDCODE_SESSION_FOR_DEV_TESTING environment variable |
| src/endpoints/schemas.ts | Extracted location schemas from server.ts into separate file |
| src/endpoints/reviews.ts | New review endpoints for star and tag reviews with authentication |
| src/endpoints/misc.ts | Extracted miscellaneous endpoints (locations, emails, slack) with critical import bug |
| src/endpoints/deprecated.ts | Moved deprecated endpoints to separate module |
| src/endpoints/auth.ts | Renamed authPlugin to authEndpoints, added dev session hardcoding, moved /whoami endpoint |
| src/deprecationNotice.ts | Deleted - content moved to endpoints/deprecated.ts |
| src/db/schema.ts | Added three new tables: tag_list, tag_reviews, star_reviews with proper constraints |
| src/db/reviews.ts | New module with CRUD operations for reviews |
| src/db/getLocations.ts | Updated type references |
| src/db/dbQueryUtils.ts | Renamed ITimeRangeInternal to IDateTimeRange |
| src/db/auth.ts | Added DBUser type export, improved return type, added JSDoc, imported env module |
| src/containers/timeBuilder.ts | Updated type references from IParsedTimeRange to ITimeSlot |
| src/containers/time/parsedTime.ts | Renamed IParsedTimeRange interface to ITimeSlot |
| drizzle/meta/_journal.json | Added migration entry for review tables |
| drizzle/meta/0006_snapshot.json | Complete database schema snapshot including new review tables |
| drizzle/0006_short_pestilence.sql | Migration SQL for creating review tables with constraints |
Comments suppressed due to low confidence (1)
src/endpoints/auth.ts:115
- The hardcoded session for dev testing bypasses the normal authentication flow and could be a serious security vulnerability if accidentally enabled in production. Consider adding a check to ensure this is only used when ENV is set to "dev", or better yet, consider using a more secure approach for testing that doesn't bypass authentication in the production code path.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Give locations a star rating, tag votes, and additionally add details to each tag vote! (styling could be improved, but idk what to change now lmao and this is good enough for a first release) (preview deployment will only work once backend PR ScottyLabs/dining-api#239) is merged) <img width="1280" height="702" alt="image" src="https://github.com/user-attachments/assets/9e7c6216-f0f5-4596-972c-a39fdcf7234f" /> <img width="270" height="2532" alt="IMG_3337" src="https://github.com/user-attachments/assets/766e1eb5-1e0e-4901-bef0-31cae3fcd63c" />
I did write a good number of tests for this (main changes are in
src/db/reviews.ts) so it should be fine... pinging @Arom1a and @GhostOf0days in case they to take a look, but otherwise I'll merge this in soon.Also cleaned up the other endpoints and moved them into separate files.