Bug: parent phone missing from /admin/players list endpoint #276

Closed
opened 2026-04-03 15:52:24 +00:00 by forgejo_admin · 1 comment

Type

Bug

Lineage

Standalone — discovered during admin CRM audit (2026-04-03). Marcus cannot see parent phone numbers.

Repo

forgejo_admin/basketball-api

What Broke

The GET /admin/players list endpoint returns parent_name and parent_email but omits parent_phone. The data exists in the parents table (parents.phone column) — e.g. Sandra Apaisa has phone 3852329501 — but the AdminPlayerItem response model doesn't include it.

The CSV export endpoint at line 526 of admin.py already includes parent_phone — the fix pattern is proven in the same file.

Repro Steps

  1. Authenticate as admin (marcusdraney23@gmail.com)
  2. GET /admin/players — response for player 111 (Aleiyah Apaisa) shows parent_name: "Sandra Apaisa" and parent_email: "apaisasandra@gmail.com" but no parent_phone field
  3. Query database directly: SELECT phone FROM parents WHERE id = 1003852329501
  4. Observe: phone exists in DB but not in API response

Expected Behavior

GET /admin/players response should include parent_phone for each player, matching parents.phone from the database join.

Environment

  • Cluster/namespace: prod / basketball-api
  • Service version: current deployment (pod running)
  • Related alerts: none — data omission, not crash

File Targets

Files to modify:

  • src/basketball_api/routes/admin.py — add parent_phone: Optional[str] = None to AdminPlayerItem model (around line 290-297), and pass parent_phone=parent.phone in the constructor where AdminPlayerItem instances are built
  • tests/test_admin_spa.py — update test assertions to verify parent_phone is present in response

Reference: the CSV export at admin.py:526 already does parent_phone=parent.phone — follow that pattern.

Files NOT to touch:

  • src/basketball_api/routes/players.py — detail endpoint already returns phone (nested as parent.phone), leave as-is

Acceptance Criteria

  • GET /admin/players response includes parent_phone field for each player
  • parent_phone value matches parents.phone from database
  • parent_phone is null for players with no parent phone set
  • Existing admin list functionality unchanged (filters, sorting, pagination)
  • Tests pass: pytest tests/test_admin_spa.py
  • project-westside-basketball
  • Companion frontend ticket: forgejo_admin/westside-landing#203
### Type Bug ### Lineage Standalone — discovered during admin CRM audit (2026-04-03). Marcus cannot see parent phone numbers. ### Repo `forgejo_admin/basketball-api` ### What Broke The `GET /admin/players` list endpoint returns `parent_name` and `parent_email` but omits `parent_phone`. The data exists in the `parents` table (`parents.phone` column) — e.g. Sandra Apaisa has phone `3852329501` — but the `AdminPlayerItem` response model doesn't include it. The CSV export endpoint at line 526 of `admin.py` already includes `parent_phone` — the fix pattern is proven in the same file. ### Repro Steps 1. Authenticate as admin (marcusdraney23@gmail.com) 2. `GET /admin/players` — response for player 111 (Aleiyah Apaisa) shows `parent_name: "Sandra Apaisa"` and `parent_email: "apaisasandra@gmail.com"` but no `parent_phone` field 3. Query database directly: `SELECT phone FROM parents WHERE id = 100` → `3852329501` 4. Observe: phone exists in DB but not in API response ### Expected Behavior `GET /admin/players` response should include `parent_phone` for each player, matching `parents.phone` from the database join. ### Environment - Cluster/namespace: prod / basketball-api - Service version: current deployment (pod running) - Related alerts: none — data omission, not crash ### File Targets Files to modify: - `src/basketball_api/routes/admin.py` — add `parent_phone: Optional[str] = None` to `AdminPlayerItem` model (around line 290-297), and pass `parent_phone=parent.phone` in the constructor where `AdminPlayerItem` instances are built - `tests/test_admin_spa.py` — update test assertions to verify `parent_phone` is present in response Reference: the CSV export at `admin.py:526` already does `parent_phone=parent.phone` — follow that pattern. Files NOT to touch: - `src/basketball_api/routes/players.py` — detail endpoint already returns phone (nested as `parent.phone`), leave as-is ### Acceptance Criteria - [ ] `GET /admin/players` response includes `parent_phone` field for each player - [ ] `parent_phone` value matches `parents.phone` from database - [ ] `parent_phone` is `null` for players with no parent phone set - [ ] Existing admin list functionality unchanged (filters, sorting, pagination) - [ ] Tests pass: `pytest tests/test_admin_spa.py` ### Related - `project-westside-basketball` - Companion frontend ticket: `forgejo_admin/westside-landing#203`
Author
Owner

Scope Review: READY

Review note: review-736-2026-04-03

Bug confirmed: AdminPlayerItem Pydantic model (admin.py:290-297) omits parent_phone while the CSV export endpoint already includes it. Fix is a 2-line change + test update. Single file, single repo, well under 5-minute agent limit.

  • Traceability: story:WS-S12 verified, arch:basketball-api label present (backing arch note missing — platform-wide gap, not blocking)
  • Blast radius: IncompletePlayerItem has the same omission (separate follow-up scope)
  • Dependencies: None — parent join already loaded, no migration needed
## Scope Review: READY Review note: `review-736-2026-04-03` Bug confirmed: `AdminPlayerItem` Pydantic model (admin.py:290-297) omits `parent_phone` while the CSV export endpoint already includes it. Fix is a 2-line change + test update. Single file, single repo, well under 5-minute agent limit. - **Traceability**: story:WS-S12 verified, arch:basketball-api label present (backing arch note missing — platform-wide gap, not blocking) - **Blast radius**: `IncompletePlayerItem` has the same omission (separate follow-up scope) - **Dependencies**: None — parent join already loaded, no migration needed
forgejo_admin 2026-04-03 16:15:14 +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#276
No description provided.