feat: add GET /jersey/player-info endpoint for token-based division lookup #147

Closed
opened 2026-03-21 21:47:12 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

plan-wkq -> Phase 11 (Girls Tryout) -> discovered as dependency of westside-app #67

Repo

forgejo_admin/basketball-api

User Story

As a parent on the jersey checkout page,
I want the page to know my child's division automatically,
So that I can see which jersey numbers are already taken in that division.

Context

The jersey number picker on westside-app (forgejo_admin/westside-app#67) needs the player's division to call GET /jersey/taken-numbers?division=.... Currently no endpoint returns player info given a registration token. The checkout endpoint uses the token internally but never exposes the division to the frontend.

File Targets

Files the agent should modify:

  • src/basketball_api/routes/jersey.py -- add GET /jersey/player-info?token=... endpoint returning { player_name, division }
  • tests/test_jersey.py -- add tests for player-info endpoint

Files the agent should NOT touch:

  • Other routes -- unrelated

Acceptance Criteria

  • GET /jersey/player-info?token=... returns { player_name, division }
  • Returns 404 for invalid tokens
  • Returns 404 when parent has no players
  • Returns null division when player has no division assigned

Test Expectations

  • Unit test: valid token returns player name and division
  • Unit test: invalid token returns 404
  • Unit test: parent with no players returns 404
  • Unit test: player with no division returns null
  • Run command: pytest tests/test_jersey.py::TestJerseyPlayerInfo -v

Constraints

  • Follow existing jersey route patterns (token query param, Parent lookup with joinedload)
  • Minimal response schema -- only expose what the frontend needs

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
### Type Feature ### Lineage `plan-wkq` -> Phase 11 (Girls Tryout) -> discovered as dependency of westside-app #67 ### Repo `forgejo_admin/basketball-api` ### User Story As a parent on the jersey checkout page, I want the page to know my child's division automatically, So that I can see which jersey numbers are already taken in that division. ### Context The jersey number picker on westside-app (forgejo_admin/westside-app#67) needs the player's division to call `GET /jersey/taken-numbers?division=...`. Currently no endpoint returns player info given a registration token. The checkout endpoint uses the token internally but never exposes the division to the frontend. ### File Targets Files the agent should modify: - `src/basketball_api/routes/jersey.py` -- add `GET /jersey/player-info?token=...` endpoint returning `{ player_name, division }` - `tests/test_jersey.py` -- add tests for player-info endpoint Files the agent should NOT touch: - Other routes -- unrelated ### Acceptance Criteria - [ ] `GET /jersey/player-info?token=...` returns `{ player_name, division }` - [ ] Returns 404 for invalid tokens - [ ] Returns 404 when parent has no players - [ ] Returns null division when player has no division assigned ### Test Expectations - [ ] Unit test: valid token returns player name and division - [ ] Unit test: invalid token returns 404 - [ ] Unit test: parent with no players returns 404 - [ ] Unit test: player with no division returns null - Run command: `pytest tests/test_jersey.py::TestJerseyPlayerInfo -v` ### Constraints - Follow existing jersey route patterns (token query param, Parent lookup with joinedload) - Minimal response schema -- only expose what the frontend needs ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-westside-basketball` - forgejo_admin/westside-app#67 -- jersey number picker (depends on this)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/basketball-api#147
No description provided.