fix: map coach profile fields to match API contract #205
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/westside-app!205
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "285-coach-profile-contract"
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
Fix two field mapping bugs on the coach profile page where the frontend read fields that don't exist in the API response contract.
Changes
src/routes/(app)/coaches/[id]/+page.svelte— changedcoach.titletocoach.roleto matchCoachProfileResponse.role. Replacedcoach.team_namewithcoach.teams?.[0]?.namesince the API returns ateamsarray, not a flatteam_namefield. Updated the fallback placeholder object to match.Test Plan
npm run checkpasses with 0 errors (7 pre-existing a11y warnings unrelated to this change)Review Checklist
CoachProfileResponse)roleinstead oftitleRelated Notes
Related
PR #205 Review
DOMAIN REVIEW
Tech stack: SvelteKit (
.sveltecomponent)Contract verification: I cross-referenced the field mappings against the API source at
/home/ldraney/basketball-api/src/basketball_api/routes/coaches_api.py:CoachProfileResponsehasrole: str-- confirmed. The oldcoach.titlefield does not exist in the contract. Fix is correct.CoachProfileResponsehasteams: list[CoachTeamResponse]whereCoachTeamResponsehasname: str-- confirmed. The oldcoach.team_namefield does not exist. Fix tocoach.teams?.[0]?.nameis correct.coach.teams?.[0]?.namein the{#if}guard means the fallback placeholder (which lacks ateamsarray) is handled safely -- the block simply won't render. The innercoach.teams[0].nameis protected by the truthy{#if}guard. No runtime error risk.titlereplaced withrole,team_nameremoved. Consistent with the contract.Accessibility: No new a11y concerns introduced. Existing structure preserved.
Scope: Exactly 1 file, 4 additions, 5 deletions. Tightly scoped to the two field mappings called out in the issue.
BLOCKERS
None.
This is a pure field-rename fix with no new functionality, so the "new functionality must have tests" blocker does not apply. The PR body confirms
npm run checkpasses with 0 errors.NITS
teams: []for completeness, so the shape matches the API contract even in the error path. Non-blocking since optional chaining handles it.SOP COMPLIANCE
285-coach-profile-contractfollows{issue-number}-{kebab-case-purpose}fix: map coach profile fields to match API contract)PROCESS OBSERVATIONS
VERDICT: APPROVED