feat: add limit/pagination to gauntletrewards endpoint (#145) #165
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#165
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/145-feat-add-limit-pagination-to-gauntletrewards-endpo"
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 #145
Adds
limitquery parameter toGET /api/v2/gauntletrewards.Changes
limit: int = 100added tov1_gauntletreward_getmax(0, min(limit, 500))— guards negative values and upper bound.limit()applied after all filters and ordering, before count and iterationcountreflects limited count (consistent with pre-existing pattern across paginated endpoints)Files Changed
app/routers_v2/gauntletrewards.pyAI Code Review
Files Reviewed
app/routers_v2/gauntletrewards.py(modified)Findings
Correctness
limit: int = 100added correctly as a query parameter.max(0, min(limit, 500))is correct — guards both negative values and the upper bound. Consistent with all prior pagination PRs (#155–#162)..limit()applied after all five filter branches (name,gauntlet_id,reward_id,win_num,loss_max) and bothorder_bycalls, beforecountand iteration — placement is correct.countreflects the limited count (not total matching rows) — consistent with the pre-existing pattern across 12 of 13 paginated endpoints (exception: gauntletruns PR #160 which computes total count). Callers fetching paginated data won't know the true total, but this is a pre-existing design choice, not introduced here.Security
limitis a plain integer, clamped before use in the ORM query.Style & Conventions
limit: int(notOptional[int]) — same cosmetic inconsistency as PRs #157, #159, #162; both type annotations behave identically in FastAPI. Non-blocking.Suggestions
limit=0returns an empty response even when rewards exist. A lower bound of 1 would prevent this confusing edge case, but this is consistent with all prior pagination PRs and not worth blocking here.countreflects limited count rather than total matching rows — a project-wide follow-up issue to add atotalfield (or renamecounttolimited_count) would benefit all 13 paginated endpoints at once.Verdict: COMMENT
Implementation is correct and follows the established pagination pattern precisely. Posting as COMMENT rather than APPROVED due to Gitea self-review restriction. Ready to merge.
Automated review by Claude PR Reviewer
Approved. Reviewer found no blocking issues — implementation is correct and consistent with the established pagination pattern.