Add graduating_class to roster API response model #71

Merged
forgejo_admin merged 1 commit from 70-add-graduating-class-to-roster-api into main 2026-03-13 19:56:35 +00:00

Summary

The RosterPlayer Pydantic model was missing graduating_class, causing the SvelteKit dashboard to show undefined for every player card. The Player SQLAlchemy model already has this field as String(10), so this maps it through to the JSON API response as str | None.

Changes

  • src/basketball_api/routes/tryouts.py -- Added graduating_class: str | None to the RosterPlayer Pydantic model and graduating_class=p.graduating_class to the constructor in api_roster().
  • tests/test_tryouts.py -- Added graduating_class parameter to the _create_player test helper. Added test_graduating_class_returned_when_set and test_graduating_class_null_when_unset tests. Updated test_all_fields_present expected fields set to include graduating_class.

Test Plan

  • pytest tests/test_tryouts.py -k "TestApiRoster" -v -- all 18 tests pass
  • pytest -- all 139 tests pass
  • ruff check src/ tests/ -- clean
  • ruff format --check src/ tests/ -- clean

Review Checklist

  • No database migrations (uses existing graduating_class column on Player model)
  • No unrelated changes
  • Pydantic type matches SQLAlchemy model type (str | None)
  • All 139 tests pass
  • Ruff lint and format clean
  • Plan: plan-2026-03-08-tryout-prep (traceability)
  • Forgejo issue: #70

Closes #70

## Summary The `RosterPlayer` Pydantic model was missing `graduating_class`, causing the SvelteKit dashboard to show `undefined` for every player card. The `Player` SQLAlchemy model already has this field as `String(10)`, so this maps it through to the JSON API response as `str | None`. ## Changes - `src/basketball_api/routes/tryouts.py` -- Added `graduating_class: str | None` to the `RosterPlayer` Pydantic model and `graduating_class=p.graduating_class` to the constructor in `api_roster()`. - `tests/test_tryouts.py` -- Added `graduating_class` parameter to the `_create_player` test helper. Added `test_graduating_class_returned_when_set` and `test_graduating_class_null_when_unset` tests. Updated `test_all_fields_present` expected fields set to include `graduating_class`. ## Test Plan - [x] `pytest tests/test_tryouts.py -k "TestApiRoster" -v` -- all 18 tests pass - [x] `pytest` -- all 139 tests pass - [x] `ruff check src/ tests/` -- clean - [x] `ruff format --check src/ tests/` -- clean ## Review Checklist - [x] No database migrations (uses existing `graduating_class` column on Player model) - [x] No unrelated changes - [x] Pydantic type matches SQLAlchemy model type (`str | None`) - [x] All 139 tests pass - [x] Ruff lint and format clean ## Related - Plan: `plan-2026-03-08-tryout-prep` (traceability) - Forgejo issue: #70 Closes #70
Add graduating_class to roster API response model
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
5e1d78c0d8
The RosterPlayer Pydantic model was missing graduating_class, causing
the SvelteKit dashboard to show undefined for every player card. The
Player SQLAlchemy model already has this field as a String(10), so this
maps it through to the JSON response as str | None.

Closes #70

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
forgejo_admin deleted branch 70-add-graduating-class-to-roster-api 2026-03-13 19:56:35 +00:00
Sign in to join this conversation.
No description provided.