Feature: Bulk toggle is_public for multiple players #217

Closed
opened 2026-03-28 19:56:34 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

Standalone — discovered during session validating public teams page. 55 players, 0 public. Admin must PATCH each one individually.

Repo

forgejo_admin/basketball-api

User Story

As an admin
I want to bulk-set player visibility for multiple players at once
So that I can populate the public teams page without 55 individual API calls

Context

is_public defaults to false (migration 024). The only way to toggle visibility is PATCH /admin/players/{id}/visibility — one player at a time. With 55 players, Marcus needs a bulk endpoint. Current data: 38 complete players ready to go public, 17 incomplete.

File Targets

Files to modify:

  • src/basketball_api/routes/admin.py — add bulk visibility endpoint
  • tests/test_admin.py — add tests for bulk endpoint

Files NOT to touch:

  • routes/public.py — already handles is_public filtering correctly
  • models.pyis_public column already exists

Acceptance Criteria

  • PATCH /admin/players/bulk-visibility accepts {player_ids: [1,2,3], is_public: true}
  • Returns count of updated players
  • Requires admin role
  • Rejects empty player_ids list
  • Tests pass

Test Expectations

  • Unit test: bulk update 3 players, verify all toggled
  • Unit test: empty list returns 400
  • Unit test: non-admin rejected
  • Run: pytest tests/test_admin.py -v

Constraints

  • Follow existing pattern from toggle_player_visibility endpoint
  • Keep it simple — no filtering logic, just accept IDs and set the flag

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • project-westside-basketball
  • forgejo_admin/westside-app #143 — teams page fix depends on public players existing
### Type Feature ### Lineage Standalone — discovered during session validating public teams page. 55 players, 0 public. Admin must PATCH each one individually. ### Repo `forgejo_admin/basketball-api` ### User Story As an admin I want to bulk-set player visibility for multiple players at once So that I can populate the public teams page without 55 individual API calls ### Context `is_public` defaults to `false` (migration 024). The only way to toggle visibility is `PATCH /admin/players/{id}/visibility` — one player at a time. With 55 players, Marcus needs a bulk endpoint. Current data: 38 complete players ready to go public, 17 incomplete. ### File Targets Files to modify: - `src/basketball_api/routes/admin.py` — add bulk visibility endpoint - `tests/test_admin.py` — add tests for bulk endpoint Files NOT to touch: - `routes/public.py` — already handles `is_public` filtering correctly - `models.py` — `is_public` column already exists ### Acceptance Criteria - [ ] `PATCH /admin/players/bulk-visibility` accepts `{player_ids: [1,2,3], is_public: true}` - [ ] Returns count of updated players - [ ] Requires admin role - [ ] Rejects empty player_ids list - [ ] Tests pass ### Test Expectations - [ ] Unit test: bulk update 3 players, verify all toggled - [ ] Unit test: empty list returns 400 - [ ] Unit test: non-admin rejected - Run: `pytest tests/test_admin.py -v` ### Constraints - Follow existing pattern from `toggle_player_visibility` endpoint - Keep it simple — no filtering logic, just accept IDs and set the flag ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `project-westside-basketball` - `forgejo_admin/westside-app #143` — teams page fix depends on public players existing
forgejo_admin 2026-03-28 21:20:51 +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#217
No description provided.