fix(#282): return 400 for invalid status/type enum params on volunteer opportunity list#534
Open
nadavosa wants to merge 2 commits into
Open
fix(#282): return 400 for invalid status/type enum params on volunteer opportunity list#534nadavosa wants to merge 2 commits into
nadavosa wants to merge 2 commits into
Conversation
| "/", | ||
| { | ||
| schema: { | ||
| querystring: volunteerOpportunityListQuerySchema, |
Collaborator
There was a problem hiding this comment.
why do we need code below for validation. pls update querystring schema instead
…rn 400 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…enforce valid status/type AJV validates `status` and `type` against the OpportunityStatusType and VolunteerStateTypeType enums via getRef() in volunteerOpportunityListQuerySchema, so the manual BadRequestError guards in the route handler are redundant. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
9b055d8 to
d7a7667
Compare
nadavosa
commented
May 22, 2026
nadavosa
left a comment
Collaborator
Author
There was a problem hiding this comment.
Addressed — removed the manual BadRequestError guards for status and type. The AJV schema (volunteerOpportunityListQuerySchema) already validates both fields against their respective enums via getRef(), so the route-level checks were redundant. Also rebased onto develop.
Collaborator
Author
|
Addressed — removed the manual |
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.
Summary
statusandtypequery params against their respective enums before passing to TypeORMBadRequestError(400) instead of letting an invalid value reach the DB and cause a 500Related
Test plan
GET /volunteer/6/opportunity?status=postreturns 400 with a descriptive messageGET /volunteer/6/opportunity?status=opp-active&type=vol-regularreturns 200🤖 Generated with Claude Code