feat: add limit/pagination to gamerewards endpoint (#144) #166
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#166
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/144-feat-add-limit-pagination-to-gamerewards-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?
Closes #144
Adds optional
limitquery parameter toGET /api/v2/gamerewards.Changes
limit: int = 100added to endpoint signature (default 100, max 500)max(0, min(limit, 500))— guards negative values and upper bound.limit()applied after all filters (name,pack_type_id,player_id,money), beforeif csv:branch — both CSV and JSON paths honour the limitFiles changed
app/routers_v2/gamerewards.pyNotes
countreflects limited count, not total — consistent with the pattern used across all other paginated endpoints (notifications, scout_claims, rewards, scout_opportunities, batstats, events, awards, pitstats, battingcardratings, gauntletruns, pitchingcardratings, mlbplayers, gauntletrewards)Review: APPROVED ✅
(Posting as COMMENT — Gitea self-review restriction prevents APPROVED state.)
Clean, consistent implementation. All mechanics correct.
Core change —
GET /api/v2/gamerewardslimit: int = 100added to endpoint signature ✅max(0, min(limit, 500))applied — guards negative values and upper bound ✅.limit()applied after all 4 filter branches (name,pack_type_id,player_id,money), beforeif csv:branch — both CSV and JSON paths honour the limit ✅countreflects limited count, not total — consistent with the pre-existing pattern across all 13 other paginated endpoints ✅Bulk of diff
Ruff auto-format (single → double quotes, parameter list reformatting) — non-functional, consistent with prior pagination PRs.
Minor (non-blocking)
limit: int(notOptional[int]) — same cosmetic inconsistency as PRs #157, #159, #162, #165. Both annotations behave identically in FastAPI with a default value present.Notes
This is now 14 endpoints paginated: notifications, scout_claims, rewards, scout_opportunities, batstats, events, awards, pitstats, battingcardratings, gauntletruns, pitchingcardratings, mlbplayers, gauntletrewards, gamerewards.
LGTM — limit/pagination implementation is correct and consistent with all prior pagination PRs. Approved.