fix: add parent_phone to /admin/players list endpoint #277
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api!277
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "276-parent-phone-admin-list"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
GET /admin/playersendpoint returnedparent_nameandparent_emailbut omittedparent_phone, despite the data existing in theparentstable. This adds the missing field following the same pattern already used by the CSV export endpoint.Changes
src/basketball_api/routes/admin.py-- Addedparent_phone: str | None = NonetoAdminPlayerItemmodel and passedparent.phonein the constructortests/test_admin_spa.py-- Addedparent_phoneto field presence assertion, added null check for parent without phone, added new test verifying populated phone valuesTest Plan
pytest tests/test_admin_spa.py-- 9/9 passingGET /admin/playersresponse includesparent_phonefor each playerparent_phoneisnullwhen parent has no phone setparent_phonematchesparents.phonefrom database when setReview Checklist
Related Notes
Related
forgejo_admin/westside-landing#203PR #277 Review
DOMAIN REVIEW
Tech stack: Python / FastAPI / SQLAlchemy / Pydantic
This is a straightforward bug fix adding
parent_phoneto theAdminPlayerItemPydantic model and its construction in theadmin_list_playersendpoint. The change follows the exact same pattern already established by the CSV export at line 526 (p.parent.phone).Model alignment:
Parent.phoneisMapped[str | None](line 181 ofmodels.py), andAdminPlayerItem.parent_phoneis typedstr | None = None. Types are consistent. The default ofNonemeans players whose parent has no phone will serialize asnull-- correct behavior.Relationship loading:
Player.parentis already eager-loaded viajoinedload(Player.parent)in the query (line 318), so accessingplayer.parent.phonewill not trigger an N+1 query. No concerns.Test coverage: Three test additions cover:
alex["parent_phone"] is None) -- edge casetest_response_fields-- structuraltest_parent_phone_populatedwith a dedicated parent fixture having a phone number -- happy pathAll three test axes (null, field presence, populated value) are covered. Well done.
BLOCKERS
None.
NITS
The CSV export at line 526 coerces
Noneto empty string (p.parent.phone or ""), while the JSON endpoint returnsnull. This is fine -- CSV needs empty strings, JSON should usenull-- but worth noting the intentional divergence for future maintainers.test_response_fieldsdoes not includecontract_status,country, orregistration_typeinexpected_fields. This is pre-existing and out of scope for this PR, but the field list has drifted. Consider a follow-up to sync it.SOP COMPLIANCE
276-parent-phone-admin-listPROCESS OBSERVATIONS
Tight, well-scoped bug fix. Two files, 34 additions, zero deletions. The companion frontend ticket (westside-landing#203) is referenced, showing good cross-repo coordination. Low change failure risk.
VERDICT: APPROVED
26b3a5376d6f2e32cc72