feat: add coach_name, team_id, height to AccountPlayerResponse #288
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!288
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "282-parent-dashboard-enrichment"
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
Enriches the parent dashboard
/account/playersendpoint withcoach_name,team_id, andheightfields so parents can see their child's coach, team identifier, and height without missing data.Changes
src/basketball_api/routes/account.py-- Addedteam_id: Optional[int],coach_name: Optional[str],height: Optional[str]toAccountPlayerResponse. Updated query to eagerly loadTeam.coachviasubqueryload+joinedload. Populated new fields from player's team/coach/profile relationships.tests/test_account.py-- Addedsample_coachfixture with team assignment. Addedtest_includes_coach_name_and_team_id(verifies assigned vs unassigned players). Addedtest_includes_height(verifies height present/null). Updatedtest_response_fieldsto assert new fields.Test Plan
ruff formatandruff checkcleanReview Checklist
ruff formatandruff checkcleanRelated Notes
Related
Closes #282
QA Review -- PR #288
Summary
Adds
coach_name,team_id, andheighttoAccountPlayerResponsefor the parent dashboard endpoint. Clean, focused change across 2 files.Findings
Route (
account.py)Optionalfields on the Pydantic model -- correct typing, correct placement.joinedload(Player.teams)tosubqueryload(Player.teams).joinedload(Team.coach)-- avoids N+1 on coach lookup. Good.team.coach.name if team and team.coach else None-- handles unassigned players and teams without coaches.player.heightis a direct column read -- no relationship traversal needed.subqueryloadandTeamare both used. No dead imports.Tests (
test_account.py)sample_coachfixture withCoachRole.head_coach-- correct enum value.sample_teamupdated to depend onsample_coachviacoach_id-- existing tests still pass since the coach is now always seeded.height="5'11\""set on player1; player2 has no height -- covers both branches.test_includes_coach_name_and_team_id: asserts assigned player gets coach name + team_id, unassigned gets null for both.test_includes_height: asserts height present vs null.test_response_fields: updated to include the 3 new field assertions.SOP Compliance
ruff formatandruff checkclean282-parent-dashboard-enrichmentfollows{issue}-{slug}conventionCloses #282Nits
None.
VERDICT: APPROVED