-
Notifications
You must be signed in to change notification settings - Fork 4
refactor: strictly type return types in backend routes #698
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
base: master
Are you sure you want to change the base?
Conversation
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 refactors backend routes to strictly type return types, specifically adding TypeScript type annotations to API endpoints. The changes introduce a new CommonBookingResponse type and apply it to the admin bookings PATCH route to improve type safety.
- Adds
CommonBookingResponsetype definition and schema - Replaces enum usage with string literal types for player levels
- Updates admin booking route to include explicit return type annotation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/shared/src/types/booking.ts | Exports new CommonBookingResponse type |
| packages/shared/src/schemas/booking.ts | Adds CommonBookingResponseSchema and replaces enum with string literals |
| apps/backend/src/app/api/admin/bookings/[id]/route.ts | Updates PATCH method with explicit return type annotation |
| user: z.union([z.string(), UserSchema]), | ||
| gameSession: z.union([z.string(), GameSessionSchema]), | ||
| playerLevel: z.nativeEnum(PlayLevel), | ||
| playerLevel: z.enum(["beginner", "intermediate", "advanced"]), |
Copilot
AI
Aug 5, 2025
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.
The hardcoded string literals for player levels replace the imported PlayLevel enum, which reduces type safety and maintainability. Consider keeping the enum import and using z.nativeEnum(PlayLevel) to maintain consistency with the type system.
Preview Deployment Status✅ Storybook Preview: https://68c9da4d.uabc-storybook.pages.dev ✅ Frontend Preview: https://3d9daf6a.uabc.pages.dev |
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
Description
WIP!
Fixes #580
Type of change
How Has This Been Tested?
Checklist before requesting a review