Add JSON roster API endpoint for playground dashboard #64

Merged
forgejo_admin merged 1 commit from 63-add-json-roster-api-endpoint-for-playgro into main 2026-03-13 18:44:19 +00:00

Summary

Adds GET /api/roster/{tenant_slug} -- a public JSON endpoint that returns all registered players with parent info, payment status, waiver status, and registration_token. Designed for the SvelteKit playground dashboard to consume. Relative photo_url values are prefixed with settings.base_url to produce absolute URLs.

Changes

  • src/basketball_api/routes/tryouts.py: Added RosterPlayer Pydantic response model and api_roster() endpoint. Reuses the same query pattern as admin_dashboard() (JOIN on Registration, eager-load Parent + Registrations) but returns JSON instead of HTML. No auth required.
  • tests/test_tryouts.py: Added 16 tests in TestApiRoster covering: JSON response shape, empty roster, 404 for unknown tenant, parent info, payment status, waiver status, registration_token, photo_url prefixing (relative, absolute, null), orphan player exclusion, age/date_of_birth, and field completeness.

Test Plan

  • Tests pass locally (16/16 new tests pass; 4 pre-existing auth failures confirmed on main)
  • ruff check and ruff format --check pass clean
  • No regressions in existing tryout routes

Review Checklist

  • No secrets committed
  • No unnecessary file changes
  • Commit messages are descriptive
  • Closes #63
  • Supports Phase 4l SvelteKit dashboard (#62)
## Summary Adds `GET /api/roster/{tenant_slug}` -- a public JSON endpoint that returns all registered players with parent info, payment status, waiver status, and registration_token. Designed for the SvelteKit playground dashboard to consume. Relative `photo_url` values are prefixed with `settings.base_url` to produce absolute URLs. ## Changes - `src/basketball_api/routes/tryouts.py`: Added `RosterPlayer` Pydantic response model and `api_roster()` endpoint. Reuses the same query pattern as `admin_dashboard()` (JOIN on Registration, eager-load Parent + Registrations) but returns JSON instead of HTML. No auth required. - `tests/test_tryouts.py`: Added 16 tests in `TestApiRoster` covering: JSON response shape, empty roster, 404 for unknown tenant, parent info, payment status, waiver status, registration_token, photo_url prefixing (relative, absolute, null), orphan player exclusion, age/date_of_birth, and field completeness. ## Test Plan - [x] Tests pass locally (16/16 new tests pass; 4 pre-existing auth failures confirmed on main) - [x] `ruff check` and `ruff format --check` pass clean - [x] No regressions in existing tryout routes ## Review Checklist - [x] No secrets committed - [x] No unnecessary file changes - [x] Commit messages are descriptive ## Related - Closes #63 - Supports Phase 4l SvelteKit dashboard (#62)
Add GET /api/roster/{tenant_slug} JSON endpoint for playground dashboard
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
d7ca39df5a
Returns all registered players as a JSON array with parent info, payment
status, waiver status, and registration_token. No auth required. Relative
photo_url values are prefixed with settings.base_url to produce absolute URLs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
forgejo_admin deleted branch 63-add-json-roster-api-endpoint-for-playgro 2026-03-13 18:44:19 +00:00
Sign in to join this conversation.
No description provided.