fix: add type annotations to untyped query parameters (#73) #86
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#86
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/73-add-type-annotations-to-untyped-query-parameters"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #73
Summary
Added missing
inttype annotations to two endpoint parameters that FastAPI was treating as strings:season: intinapp/routers_v3/transactions.py(GET /api/v3/transactions)stan_id: intinapp/routers_v3/standings.py(PATCH /api/v3/standings/{stan_id})Without annotations, FastAPI passes these as strings to the ORM, which can cause type mismatches when PostgreSQL compares them against integer columns.
Files Changed
app/routers_v3/transactions.py—seasonparameter annotated asintapp/routers_v3/standings.py—stan_idpath parameter annotated asintTests
No test suite configured for this repo. Changes verified by reading back modified files.
AI Code Review
Files Reviewed
app/routers_v3/transactions.py(modified)app/routers_v3/standings.py(modified)Findings
Correctness
standings.py:stan_id: inton a path parameter (/{stan_id}) is correct. FastAPI will now validate and coerce the path segment to int before passing toStandings.get_by_id(stan_id), eliminating the ORM string/int mismatch.transactions.py:season: inton a query parameter is correct. The parameter has no default so it remains required; FastAPI now also validates the value is a valid integer (returns 422 on bad input instead of passing a string toTransaction.select_season).Security
Style & Conventions
get_standingsalready usesseason: int,get_team_standingsusesteam_id: int,post_standingsusesseason: int. These two annotations bring the remaining untyped params in line.Suggestions
patch_transactionsanddelete_transactionsintransactions.pystill have untypedmove_idpath params. Worth a follow-up issue.logger.warning(f"patch_standings - Bad Token: {token}")still interpolates the token value — tracked separately.Verdict: APPROVED
Both changes are correct, minimal, and consistent with the existing annotation patterns in each file. FastAPI's automatic coercion and 422 validation on these parameters is strictly better than the previous untyped behavior.
Automated review by Claude PR Reviewer
Checkout
From your project repository, check out a new branch and test the changes.