feat: add parent_phone/parent_email to admin CRM response models #287
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!287
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "281-admin-crm-parent-fields"
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
Add missing parent contact fields to
IncompletePlayerItemandTeamPlayerItemresponse models so the frontend can display complete parent information in admin CRM views.Changes
src/basketball_api/routes/admin.py— Addedparent_phone: str | NonetoIncompletePlayerItemmodel and populated fromp.parent.phone. Addedparent_phone: str | Noneandparent_email: str | NonetoTeamPlayerItemmodel and populated from parent relationship.tests/test_admin_email.py— Added test forparent_phonepresent in incomplete players response, and test for null when parent has no phone.tests/test_admin_teams.py— Added assertions forparent_phoneandparent_emailin existing player shape test. Added new test verifying fields are populated when parent has contact info.Test Plan
pytest tests/test_admin_email.py tests/test_admin_teams.py— 43 tests passparent_phonereturns value when parent has phone, null when missingparent_emailreturns value in TeamPlayerItem responseReview Checklist
ruff formatandruff checkcleanRelated Notes
Related
PR #287 Review
DOMAIN REVIEW
Stack: Python / FastAPI / SQLAlchemy / Pydantic
This PR adds
parent_phonetoIncompletePlayerItemandparent_phone+parent_emailtoTeamPlayerItem-- two admin CRM response models. The implementation is correct:Parent.phoneisMapped[str | None], and the Pydantic fields usestr | None = None.Parent.emailisMapped[str](non-nullable)._query_incomplete_players()andadmin_teams()already usejoinedload(Player.parent), sop.parent.phoneandp.parent.emailare accessed from eagerly-loaded data.AdminPlayerItemuses a separate model and these fields are added to distinct response models (IncompletePlayerItem,TeamPlayerItem).BLOCKERS
None.
NITS
TeamPlayerItem.parent_emailtyped asstr | None = NonebutParent.emailis non-nullable (Mapped[str]). This won't break anything (the field will always be populated), but it is slightly misleading -- it suggests the value can be null when it cannot. For consistency withIncompletePlayerItem.parent_email: str, consider typing it asstrinstead. Non-blocking.SOP COMPLIANCE
281-admin-crm-parent-fieldsfollows{issue-number}-{kebab-case-purpose}PROCESS OBSERVATIONS
VERDICT: APPROVED