Add GET /admin/players/{id} detail endpoint #249

Closed
opened 2026-03-29 19:55:40 +00:00 by forgejo_admin · 2 comments
Contributor

Type

Feature

Lineage

Decomposed from forgejo_admin/westside-landing#185. Backend blocker — no detail endpoint exists for the CRM player detail view.

Repo

forgejo_admin/basketball-api

User Story

As Marcus (admin)
I want a player detail API endpoint
So that the CRM can show all info for a single player on a detail page

Context

The admin CRM has a player list (GET /admin/players) but no single-player detail endpoint. A non-admin players/{id} route exists in the frontend for profile editing, but the API doesn't expose a comprehensive admin view. The detail endpoint should return everything: personal info, parent info, team, registration, payment, contract, and jersey data.

File Targets

Files the agent should modify:

  • src/basketball_api/routes/admin.py — add GET /admin/players/{player_id} endpoint with a comprehensive response model

Files the agent should NOT touch:

  • src/basketball_api/routes/jersey.py — jersey ordering
  • src/basketball_api/models.py — no model changes needed
  • Existing GET /admin/players list endpoint — leave as-is

Acceptance Criteria

  • GET /admin/players/{player_id} returns comprehensive player data
  • Response includes: name, photo_url, date_of_birth, height, position, current_school, graduating_class, hometown, division, country
  • Response includes parent info: parent_name, parent_email
  • Response includes: team names, registration status, contract_status, contract_signed_at
  • Response includes: jersey_option, jersey_size, jersey_number, jersey_order_status
  • 404 for non-existent player_id
  • Requires admin role

Test Expectations

  • Unit test: returns full player data for valid ID
  • Unit test: 404 for missing player
  • Unit test: requires admin auth
  • Run command: pytest tests/test_admin.py -v

Constraints

  • Match existing admin endpoint patterns (auth, response models, error handling)
  • Reuse existing model relationships (Player.parent, Player.teams, Player.registrations)

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • project-westside-basketball
  • forgejo_admin/westside-landing#185 — CRM frontend detail page (depends on this)
### Type Feature ### Lineage Decomposed from `forgejo_admin/westside-landing#185`. Backend blocker — no detail endpoint exists for the CRM player detail view. ### Repo `forgejo_admin/basketball-api` ### User Story As Marcus (admin) I want a player detail API endpoint So that the CRM can show all info for a single player on a detail page ### Context The admin CRM has a player list (`GET /admin/players`) but no single-player detail endpoint. A non-admin `players/{id}` route exists in the frontend for profile editing, but the API doesn't expose a comprehensive admin view. The detail endpoint should return everything: personal info, parent info, team, registration, payment, contract, and jersey data. ### File Targets Files the agent should modify: - `src/basketball_api/routes/admin.py` — add `GET /admin/players/{player_id}` endpoint with a comprehensive response model Files the agent should NOT touch: - `src/basketball_api/routes/jersey.py` — jersey ordering - `src/basketball_api/models.py` — no model changes needed - Existing `GET /admin/players` list endpoint — leave as-is ### Acceptance Criteria - [ ] `GET /admin/players/{player_id}` returns comprehensive player data - [ ] Response includes: name, photo_url, date_of_birth, height, position, current_school, graduating_class, hometown, division, country - [ ] Response includes parent info: parent_name, parent_email - [ ] Response includes: team names, registration status, contract_status, contract_signed_at - [ ] Response includes: jersey_option, jersey_size, jersey_number, jersey_order_status - [ ] 404 for non-existent player_id - [ ] Requires admin role ### Test Expectations - [ ] Unit test: returns full player data for valid ID - [ ] Unit test: 404 for missing player - [ ] Unit test: requires admin auth - Run command: `pytest tests/test_admin.py -v` ### Constraints - Match existing admin endpoint patterns (auth, response models, error handling) - Reuse existing model relationships (Player.parent, Player.teams, Player.registrations) ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-westside-basketball` - `forgejo_admin/westside-landing#185` — CRM frontend detail page (depends on this)
Author
Contributor

Scope Review: NEEDS_REFINEMENT

Review note: review-676-2026-03-29

Issue template is fully complete and file targets verified — the scope is solid. Two traceability gaps need fixing before execution:

  • [LABEL] story:WS-S5 is a mismatch. WS-S5 = CNPG backups (superadmin) / dashboard stats (admin). This work maps to story:WS-S12 ("manage user accounts, view profiles"). Update the board item label.
  • [SCOPE] No arch-basketball-api note exists in pal-e-docs. Create the architecture note to complete the traceability triangle.
## Scope Review: NEEDS_REFINEMENT Review note: `review-676-2026-03-29` Issue template is fully complete and file targets verified — the scope is solid. Two traceability gaps need fixing before execution: - **[LABEL]** `story:WS-S5` is a mismatch. WS-S5 = CNPG backups (superadmin) / dashboard stats (admin). This work maps to `story:WS-S12` ("manage user accounts, view profiles"). Update the board item label. - **[SCOPE]** No `arch-basketball-api` note exists in pal-e-docs. Create the architecture note to complete the traceability triangle.
Author
Contributor

Scope Review: READY

Review note: review-676-2026-03-29
Scope is solid — template complete, story:WS-S12 verified on project page, file target confirmed, all Player model fields exist. Arch note gap (arch-basketball-api) is a known platform-wide item, not a blocker for this ticket. Single file, single repo, under 5 minutes. Ready for dispatch.

## Scope Review: READY Review note: `review-676-2026-03-29` Scope is solid — template complete, story:WS-S12 verified on project page, file target confirmed, all Player model fields exist. Arch note gap (arch-basketball-api) is a known platform-wide item, not a blocker for this ticket. Single file, single repo, under 5 minutes. Ready for dispatch.
forgejo_admin 2026-03-29 20:11:02 +00:00
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
ldraney/basketball-api#249
No description provided.