Feature: PATCH /admin/players/{id}/visibility toggle #189

Closed
opened 2026-03-27 20:54:06 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

Split from westside-app#111. Unblocks public teams page — 78 players with is_public=False means empty rosters.

Repo

forgejo_admin/basketball-api

User Story

As an admin (Marcus)
I want an API endpoint to toggle player visibility
So that players appear on the public teams page

Context

Migration 024 added is_public boolean to players (defaults False). GET /public/teams filters by is_public=True. Currently 0 players are public, so the teams page shows empty rosters. This endpoint lets the admin UI toggle visibility.

File Targets

Files the agent should modify:

  • src/basketball_api/routes/admin.py — add PATCH /admin/players/{id}/visibility endpoint
  • tests/ — add test for the new endpoint

Files the agent should NOT touch:

  • src/basketball_api/routes/public.py — already works correctly
  • src/basketball_api/models.py — is_public column already exists

Acceptance Criteria

  • PATCH /admin/players/{id}/visibility accepts {"is_public": true/false}
  • Returns updated player with new is_public value
  • Requires authentication (admin role)
  • 404 if player not found

Test Expectations

  • Toggle true → player visible in GET /public/teams
  • Toggle false → player excluded from GET /public/teams
  • 404 for non-existent player

Constraints

  • Follow existing admin.py patterns for auth
  • No model changes needed (is_public column exists)
  • Single endpoint, single file change

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • westside-app#111 (frontend consumer)
  • basketball-api#186 (same public.py pattern)
  • project-westside-basketball
  • story:WS-S6
### Type Feature ### Lineage Split from westside-app#111. Unblocks public teams page — 78 players with is_public=False means empty rosters. ### Repo `forgejo_admin/basketball-api` ### User Story As an admin (Marcus) I want an API endpoint to toggle player visibility So that players appear on the public teams page ### Context Migration 024 added `is_public` boolean to players (defaults False). GET /public/teams filters by is_public=True. Currently 0 players are public, so the teams page shows empty rosters. This endpoint lets the admin UI toggle visibility. ### File Targets Files the agent should modify: - `src/basketball_api/routes/admin.py` — add PATCH /admin/players/{id}/visibility endpoint - `tests/` — add test for the new endpoint Files the agent should NOT touch: - `src/basketball_api/routes/public.py` — already works correctly - `src/basketball_api/models.py` — is_public column already exists ### Acceptance Criteria - [ ] PATCH /admin/players/{id}/visibility accepts `{"is_public": true/false}` - [ ] Returns updated player with new is_public value - [ ] Requires authentication (admin role) - [ ] 404 if player not found ### Test Expectations - [ ] Toggle true → player visible in GET /public/teams - [ ] Toggle false → player excluded from GET /public/teams - [ ] 404 for non-existent player ### Constraints - Follow existing admin.py patterns for auth - No model changes needed (is_public column exists) - Single endpoint, single file change ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - westside-app#111 (frontend consumer) - basketball-api#186 (same public.py pattern) - `project-westside-basketball` - `story:WS-S6`
forgejo_admin 2026-03-27 21:04:15 +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
forgejo_admin/basketball-api#189
No description provided.