feat: add limit/pagination to gamerewards endpoint (#144) #166

Merged
cal merged 3 commits from issue/144-feat-add-limit-pagination-to-gamerewards-endpoint into main 2026-03-24 12:06:23 +00:00
Collaborator

Closes #144

Adds optional limit query parameter to GET /api/v2/gamerewards.

Changes

  • limit: int = 100 added to endpoint signature (default 100, max 500)
  • Capped via max(0, min(limit, 500)) — guards negative values and upper bound
  • .limit() applied after all filters (name, pack_type_id, player_id, money), before if csv: branch — both CSV and JSON paths honour the limit

Files changed

  • app/routers_v2/gamerewards.py

Notes

  • count reflects 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)
  • No test suite in this repo
Closes #144 Adds optional `limit` query parameter to `GET /api/v2/gamerewards`. ## Changes - `limit: int = 100` added to endpoint signature (default 100, max 500) - Capped via `max(0, min(limit, 500))` — guards negative values and upper bound - `.limit()` applied after all filters (`name`, `pack_type_id`, `player_id`, `money`), before `if csv:` branch — both CSV and JSON paths honour the limit ## Files changed - `app/routers_v2/gamerewards.py` ## Notes - `count` reflects 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) - No test suite in this repo
Claude added 1 commit 2026-03-24 11:32:25 +00:00
Closes #144

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude added the
ai-reviewing
label 2026-03-24 11:45:47 +00:00
Claude reviewed 2026-03-24 11:46:20 +00:00
Claude left a comment
Author
Collaborator

Review: APPROVED

(Posting as COMMENT — Gitea self-review restriction prevents APPROVED state.)

Clean, consistent implementation. All mechanics correct.

Core change — GET /api/v2/gamerewards

  • limit: int = 100 added 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), before if csv: branch — both CSV and JSON paths honour the limit
  • count reflects 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 (not Optional[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.

## Review: APPROVED ✅ *(Posting as COMMENT — Gitea self-review restriction prevents APPROVED state.)* Clean, consistent implementation. All mechanics correct. ### Core change — `GET /api/v2/gamerewards` - `limit: int = 100` added 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`), before `if csv:` branch — both CSV and JSON paths honour the limit ✅ - `count` reflects 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` (not `Optional[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.
Claude removed the
ai-reviewing
label 2026-03-24 11:46:50 +00:00
cal approved these changes 2026-03-24 12:04:56 +00:00
cal left a comment
Owner

LGTM — limit/pagination implementation is correct and consistent with all prior pagination PRs. Approved.

LGTM — limit/pagination implementation is correct and consistent with all prior pagination PRs. Approved.
cal added 1 commit 2026-03-24 12:05:17 +00:00
cal added 1 commit 2026-03-24 12:05:54 +00:00
cal merged commit c39360fa57 into main 2026-03-24 12:06:23 +00:00
cal deleted branch issue/144-feat-add-limit-pagination-to-gamerewards-endpoint 2026-03-24 12:06:23 +00:00
Sign in to join this conversation.
No description provided.