-
Notifications
You must be signed in to change notification settings - Fork 5
LVT-51: Specific state in team lookup for when there's no data or a team doesn't exist #45
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
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 explicit error handling for team lookup endpoints to distinguish between non-existent teams and teams with no data. When a team doesn't exist in the database, the handlers return "TEAM_DOES_NOT_EXIST", and when a team exists but has no associated data, they return "NO_DATA_FOR_TEAM" (note: the actual response is the error string, not an object containing it, due to how the analysisHandler processes error responses).
Key Changes:
- Added team existence validation using Prisma's
findUniquequery before processing data - Added no-data detection logic that checks if any relevant data exists for the team
- Applied changes consistently across three team lookup handlers
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/handler/analysis/teamLookUp/getNotes.ts |
Added team existence check and empty notes validation; includes an unused import that should be removed |
src/handler/analysis/teamLookUp/categoryMetrics.ts |
Added team existence check and validates whether any metric has data; contains potential issue with treating 0 values as "no data" |
src/handler/analysis/teamLookUp/breakdownMetrics.ts |
Added team existence check and validates whether any breakdown metric has valid data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
responds with
{ "TEAM_DOES_NOT_EXIST" }or{ "NO_DATA_FOR_TEAM" }