Add public schedule endpoint (GET /public/schedule) #239

Closed
opened 2026-03-29 03:52:27 +00:00 by forgejo_admin · 1 comment
Contributor

Type

Feature

Lineage

Prerequisite for forgejo_admin/westside-landing#172 (public schedule page refactor). Admin schedule endpoints (#232, #233) are merged. This adds the unauthenticated public equivalent.

Repo

forgejo_admin/basketball-api

User Story

story:WS-S13 As a prospect or parent, I want to see the current schedule on the public website without needing to log in.

Context

The admin schedule endpoints (GET /admin/schedule/*) require require_role("admin"). The public schedule page needs an unauthenticated endpoint following the existing pattern of GET /public/teams and GET /public/coaches in routes/public.py.

The endpoint should return the same data shape as GET /admin/schedule but:

  • Only active practices (is_active=true)
  • Only future or current events (start_date >= today or no filter — let frontend handle display)
  • No tenant scoping needed if single-tenant (follow existing public route pattern)

File Targets

Files to modify:

  • src/basketball_api/routes/public.py — add GET /public/schedule endpoint returning { practices: [...], events: [...] }

Pattern reference (do NOT modify):

  • src/basketball_api/routes/schedule.py — admin schedule endpoints (query patterns, response schemas to reuse)
  • src/basketball_api/routes/public.py — existing public routes pattern (no auth, tenant from slug)

Files NOT to touch:

  • src/basketball_api/routes/schedule.py — admin endpoints stay as-is
  • src/basketball_api/models.py — no model changes

Acceptance Criteria

  • GET /public/schedule returns { practices: [...], events: [...] }
  • No authentication required
  • Only active practices returned (is_active=true)
  • Response shape matches admin schedule endpoint for frontend compatibility
  • Existing tests still pass

Test Expectations

  • Happy path: endpoint returns practices and events
  • No auth required: request without token succeeds
  • Active filter: inactive practices excluded
  • Run command: pytest tests/ -v

Constraints

  • Follow existing routes/public.py patterns (no auth dependency, tenant from path or default)
  • Reuse Pydantic response schemas from routes/schedule.py where possible
  • Keep it simple — read-only, no filters needed beyond is_active

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • Blocks: forgejo_admin/westside-landing#172 (public schedule page refactor)
  • forgejo_admin/basketball-api#232 — data model (merged)
  • forgejo_admin/basketball-api#233 — admin endpoints (merged)
  • project-westside-basketball
### Type Feature ### Lineage Prerequisite for `forgejo_admin/westside-landing#172` (public schedule page refactor). Admin schedule endpoints (#232, #233) are merged. This adds the unauthenticated public equivalent. ### Repo `forgejo_admin/basketball-api` ### User Story `story:WS-S13` As a prospect or parent, I want to see the current schedule on the public website without needing to log in. ### Context The admin schedule endpoints (`GET /admin/schedule/*`) require `require_role("admin")`. The public schedule page needs an unauthenticated endpoint following the existing pattern of `GET /public/teams` and `GET /public/coaches` in `routes/public.py`. The endpoint should return the same data shape as `GET /admin/schedule` but: - Only active practices (`is_active=true`) - Only future or current events (`start_date >= today` or no filter — let frontend handle display) - No tenant scoping needed if single-tenant (follow existing public route pattern) ### File Targets Files to modify: - `src/basketball_api/routes/public.py` — add `GET /public/schedule` endpoint returning `{ practices: [...], events: [...] }` Pattern reference (do NOT modify): - `src/basketball_api/routes/schedule.py` — admin schedule endpoints (query patterns, response schemas to reuse) - `src/basketball_api/routes/public.py` — existing public routes pattern (no auth, tenant from slug) Files NOT to touch: - `src/basketball_api/routes/schedule.py` — admin endpoints stay as-is - `src/basketball_api/models.py` — no model changes ### Acceptance Criteria - [ ] `GET /public/schedule` returns `{ practices: [...], events: [...] }` - [ ] No authentication required - [ ] Only active practices returned (`is_active=true`) - [ ] Response shape matches admin schedule endpoint for frontend compatibility - [ ] Existing tests still pass ### Test Expectations - [ ] Happy path: endpoint returns practices and events - [ ] No auth required: request without token succeeds - [ ] Active filter: inactive practices excluded - Run command: `pytest tests/ -v` ### Constraints - Follow existing `routes/public.py` patterns (no auth dependency, tenant from path or default) - Reuse Pydantic response schemas from `routes/schedule.py` where possible - Keep it simple — read-only, no filters needed beyond is_active ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - Blocks: `forgejo_admin/westside-landing#172` (public schedule page refactor) - `forgejo_admin/basketball-api#232` — data model (merged) - `forgejo_admin/basketball-api#233` — admin endpoints (merged) - `project-westside-basketball`
Author
Contributor

Scope Review: APPROVED

Review note: review-653-2026-03-28
Scope is solid. All template sections present, traceability complete, file targets verified. Single file modification (routes/public.py) following established no-auth pattern. Unblocks board item #649 (westside-app schedule refactor). No decomposition needed.

## Scope Review: APPROVED Review note: `review-653-2026-03-28` Scope is solid. All template sections present, traceability complete, file targets verified. Single file modification (`routes/public.py`) following established no-auth pattern. Unblocks board item #649 (westside-app schedule refactor). No decomposition needed.
forgejo_admin 2026-03-29 04:03:20 +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#239
No description provided.