Add team_ids to AccountPlayerResponse for parent schedule filtering #333

Closed
opened 2026-04-04 21:28:16 +00:00 by forgejo_admin · 1 comment
Contributor

Type

Feature

User Story

story:WS-S28 As a parent, I want to see my child's team practice schedule so I know when and where to take them.

Lineage

  • Story: story:WS-S28
  • Arch: arch:basketball-api
  • Blocked by: Nothing
  • Blocks: westside-landing#214 (parent dashboard schedule)

Repo

forgejo_admin/basketball-api

Context

The GET /account/players endpoint returns team_name (derived from the first team) but not team_id or team_ids. The parent dashboard (#214) needs team IDs to filter /public/schedule client-side and show each player's team schedule. Players can be on multiple teams via the player_teams M2M table.

File Targets

  • src/basketball_api/routes/account.py — add team_ids: list[int] to AccountPlayerResponse and populate from player.teams

Acceptance Criteria

  • GET /account/players response includes team_ids: list[int] per player
  • Players on multiple teams return all team IDs
  • Players with zero teams return empty list
  • Existing team_name field unchanged (backwards compatible)

Test Expectations

  • Existing tests pass unchanged
  • Add test for multi-team player returning multiple IDs
  • Add test for zero-team player returning empty list

Constraints

  • No new endpoints — just enrich existing response
  • Must handle players with zero teams (empty list)

Checklist

  • Add team_ids: list[int] field to AccountPlayerResponse
  • Populate with [t.id for t in player.teams]
  • Verify existing tests pass
  • Add test for multi-team player returning multiple IDs
  • westside-landing#214 (parent dashboard schedule — consumes this field)
  • westside-landing#213 (coach dashboard — uses /coaches/me which already has team IDs)
  • basketball-api#279 (seed practice_schedules — data this enables filtering of)
### Type Feature ### User Story `story:WS-S28` As a parent, I want to see my child's team practice schedule so I know when and where to take them. ### Lineage - **Story:** `story:WS-S28` - **Arch:** `arch:basketball-api` - **Blocked by:** Nothing - **Blocks:** westside-landing#214 (parent dashboard schedule) ### Repo `forgejo_admin/basketball-api` ### Context The `GET /account/players` endpoint returns `team_name` (derived from the first team) but not `team_id` or `team_ids`. The parent dashboard (#214) needs team IDs to filter `/public/schedule` client-side and show each player's team schedule. Players can be on multiple teams via the `player_teams` M2M table. ### File Targets - `src/basketball_api/routes/account.py` — add `team_ids: list[int]` to `AccountPlayerResponse` and populate from `player.teams` ### Acceptance Criteria - `GET /account/players` response includes `team_ids: list[int]` per player - Players on multiple teams return all team IDs - Players with zero teams return empty list - Existing `team_name` field unchanged (backwards compatible) ### Test Expectations - Existing tests pass unchanged - Add test for multi-team player returning multiple IDs - Add test for zero-team player returning empty list ### Constraints - No new endpoints — just enrich existing response - Must handle players with zero teams (empty list) ### Checklist - [ ] Add `team_ids: list[int]` field to `AccountPlayerResponse` - [ ] Populate with `[t.id for t in player.teams]` - [ ] Verify existing tests pass - [ ] Add test for multi-team player returning multiple IDs ### Related - westside-landing#214 (parent dashboard schedule — consumes this field) - westside-landing#213 (coach dashboard — uses `/coaches/me` which already has team IDs) - basketball-api#279 (seed practice_schedules — data this enables filtering of)
forgejo_admin 2026-04-04 21:44:20 +00:00
Author
Contributor

Validation: PASS

Tiers executed: Tier 1 (CI tests), Tier 3 (Production)
Validation note: validation-333-2026-04-04

5 checks: 5 PASS, 0 FAIL

# Criterion Result
1 team_ids: list[int] in response schema PASS
2 Multi-team players return all IDs PASS
3 Zero-team players return empty list PASS
4 team_name backwards compatible PASS
5 Parent dashboard consumes team_ids PASS

Evidence: Pipeline #335 (merge) green, Pipeline #349 (latest main) 817 passed/0 failed, live OpenAPI schema confirmed, pod running 0 restarts, regression endpoints healthy.

## Validation: PASS Tiers executed: Tier 1 (CI tests), Tier 3 (Production) Validation note: `validation-333-2026-04-04` **5 checks: 5 PASS, 0 FAIL** | # | Criterion | Result | |---|-----------|--------| | 1 | `team_ids: list[int]` in response schema | PASS | | 2 | Multi-team players return all IDs | PASS | | 3 | Zero-team players return empty list | PASS | | 4 | `team_name` backwards compatible | PASS | | 5 | Parent dashboard consumes team_ids | PASS | Evidence: Pipeline #335 (merge) green, Pipeline #349 (latest main) 817 passed/0 failed, live OpenAPI schema confirmed, pod running 0 restarts, regression endpoints healthy.
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#333
No description provided.