feat: add limit/pagination to awards endpoint (#132) #157
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#157
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/132-feat-add-limit-pagination-to-awards-endpoint"
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?
Summary
limitquery param (default 100, max 500) toGET /api/v2/awardsmax(0, min(limit, 500))— guards negative values and upper bound.limit()applied after all filters; both CSV and JSON paths honour the limitCloses #132
AI Code Review
Files Reviewed
app/routers_v2/awards.py(modified)Findings
Correctness
limit: int = 100correctly uses a plainintwith a default (rather thanOptional[int] = 100as the prior 6 pagination endpoints do). This is functionally equivalent for FastAPI query params — and arguably more correct sinceNoneis never a meaningful limit value. The PR description saysOptional[int]but the code is better than described.max(0, min(limit, 500))clamping is correct: guards negative values and upper bound. ✅.limit()applied after all filters, before theif csv:branch — both CSV and JSON paths honour the limit. ✅Optionalalready imported at line 2 — no missing import. ✅Security
Style & Conventions
Suggestions
countin the JSON response reflects the limited row count, not the total matching rows. This is the pre-existing pattern across all 7 paginated endpoints (notifications,scout_claims,rewards,scout_opportunities,batstats,events,awards). Non-blocking — noted for completeness. A follow-up issue to add atotalfield across all paginated endpoints would be the clean resolution.limit=0returns an empty response even when matching awards exist (max(0, …)lower-clamps to 0, and PeeweeLIMIT 0returns nothing). Same edge case as all prior pagination PRs. Non-blocking.Verdict: COMMENT
Clean, correct implementation that matches the established pagination pattern. The
int = 100(vsOptional[int] = 100) deviation from prior endpoints is a minor positive. Both minor notes are pre-existing across the full pagination series and non-blocking. Posting as COMMENT due to Gitea self-review restriction — this would otherwise be APPROVED.Automated review by Claude PR Reviewer
Approved. Clean pagination implementation consistent with the established pattern. Reviewer notes are pre-existing non-blockers across the full pagination series.