fix: add division/age_group to public teams, rename school field #213

Merged
forgejo_admin merged 1 commit from 211-public-teams-add-division-fix-school into main 2026-03-28 19:08:48 +00:00

Summary

PublicTeamResponse was missing division and age_group fields needed by the westside-app frontend for Kings/Queens filtering. Also renamed current_school to school in PublicPlayerResponse to match what the frontend reads.

Changes

  • src/basketball_api/routes/public.py:
    • Added division: str | None and age_group: str | None to PublicTeamResponse
    • Pass team.division.value and team.age_group.value when constructing the response
    • Renamed current_school to school in PublicPlayerResponse
    • Updated _public_player() helper to map player.current_school to school
  • tests/test_public.py:
    • Updated allowed_keys assertions for both team and player field sets
    • Updated current_school assertion to school

Test Plan

  • pytest tests/test_public.py -v -- 21/21 pass
  • ruff check . -- all checks passed
  • GET /public/teams returns division and age_group per team
  • Player objects use school field name (not current_school)

Review Checklist

  • Tests pass locally
  • Ruff lint and format clean
  • No sensitive data exposed (public endpoint allowlist unchanged except for new fields)
  • Breaking change: current_school renamed to school -- westside-app already reads school, so this is the fix not the break

N/A -- no pal-e-docs notes associated with this bug fix.

## Summary PublicTeamResponse was missing `division` and `age_group` fields needed by the westside-app frontend for Kings/Queens filtering. Also renamed `current_school` to `school` in PublicPlayerResponse to match what the frontend reads. ## Changes - `src/basketball_api/routes/public.py`: - Added `division: str | None` and `age_group: str | None` to `PublicTeamResponse` - Pass `team.division.value` and `team.age_group.value` when constructing the response - Renamed `current_school` to `school` in `PublicPlayerResponse` - Updated `_public_player()` helper to map `player.current_school` to `school` - `tests/test_public.py`: - Updated `allowed_keys` assertions for both team and player field sets - Updated `current_school` assertion to `school` ## Test Plan - [x] `pytest tests/test_public.py -v` -- 21/21 pass - [x] `ruff check .` -- all checks passed - [ ] GET /public/teams returns `division` and `age_group` per team - [ ] Player objects use `school` field name (not `current_school`) ## Review Checklist - [x] Tests pass locally - [x] Ruff lint and format clean - [x] No sensitive data exposed (public endpoint allowlist unchanged except for new fields) - [x] Breaking change: `current_school` renamed to `school` -- westside-app already reads `school`, so this is the fix not the break ## Related - Closes #211 ## Related Notes N/A -- no pal-e-docs notes associated with this bug fix.
fix: add division/age_group to public teams, rename school field
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
8f004a6b01
PublicTeamResponse was missing division and age_group fields needed by
the westside-app frontend for Kings/Queens filtering. Also renamed
current_school to school in PublicPlayerResponse to match frontend.

Closes #211

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

QA Review -- PR #213

Diff Summary

2 files changed, +9/-5. Minimal, focused fix.

Findings

Schema changes (public.py)

  • PublicPlayerResponse.current_school renamed to school -- maps correctly from player.current_school in _public_player(). No data loss.
  • PublicTeamResponse gains division: str | None and age_group: str | None -- both use .value enum extraction with proper null guards (if team.division else None). Correct pattern matching existing age_group usage in _team_sort_key.
  • Fields are str | None, not enum types -- correct for a public JSON API response.

Test changes (test_public.py)

  • allowed_keys updated for both player and team field sets -- matches new schema exactly.
  • current_school assertion updated to school -- matches the rename.
  • 21/21 tests pass per PR author.

Nits: None.

Concerns: None. The current_school -> school rename is a breaking change for any consumer reading current_school, but the PR body correctly notes westside-app already reads school, making this the fix not the break.

VERDICT: APPROVED

## QA Review -- PR #213 ### Diff Summary 2 files changed, +9/-5. Minimal, focused fix. ### Findings **Schema changes (public.py)** - `PublicPlayerResponse.current_school` renamed to `school` -- maps correctly from `player.current_school` in `_public_player()`. No data loss. - `PublicTeamResponse` gains `division: str | None` and `age_group: str | None` -- both use `.value` enum extraction with proper null guards (`if team.division else None`). Correct pattern matching existing `age_group` usage in `_team_sort_key`. - Fields are `str | None`, not enum types -- correct for a public JSON API response. **Test changes (test_public.py)** - `allowed_keys` updated for both player and team field sets -- matches new schema exactly. - `current_school` assertion updated to `school` -- matches the rename. - 21/21 tests pass per PR author. **Nits:** None. **Concerns:** None. The `current_school` -> `school` rename is a breaking change for any consumer reading `current_school`, but the PR body correctly notes westside-app already reads `school`, making this the fix not the break. ### VERDICT: APPROVED
forgejo_admin deleted branch 211-public-teams-add-division-fix-school 2026-03-28 19:08:48 +00:00
Sign in to join this conversation.
No description provided.