Add player_id param to jersey and checkout endpoints for multi-player parents #256
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
ldraney/basketball-api#256
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type
Feature
Lineage
Child of
forgejo_admin/westside-landing#196(spike: player self-service jersey ordering).Depends on: dual-auth dependency ticket (basketball-api).
Story: WS-S18
Repo
forgejo_admin/basketball-apiUser Story
As a parent with multiple players
I want to select which player I'm ordering a jersey for
So that the order is placed for the correct child
Context
Both
jersey.py(line 127) andcheckout.py(line 147) useparent.players[0]— always grabbing the first player. In the email-link flow this was acceptable because most parents have one player. In the session-auth flow, the parent is identified by email and the SPA dashboard shows ALL their players. Without aplayer_idparameter, there's no way to order for a specific child.The
account.py/playersendpoint already returns all players for a parent, and the frontendmy-players/+page.svelterenders them as a list. The jersey flow needs to accept which player was selected.File Targets
Files the agent should modify or create:
src/basketball_api/routes/jersey.py— addplayer_id: int | None = Query(None)tojersey_player_info(line 106) andjersey_checkout(line 172); validate player belongs to parentsrc/basketball_api/routes/checkout.py— addplayer_id: int | None = Query(None)tocreate_checkout_session(line 103); validate player belongs to parenttests/— add tests for player_id selectionFiles the agent should NOT touch:
src/basketball_api/routes/register.py— unrelatedsrc/basketball_api/routes/tryouts.py— unrelatedAcceptance Criteria
/jersey/checkout?player_id=5and player 5 belongs to my parent record, then the order is for player 5/jersey/checkout?player_id=99and player 99 does NOT belong to my parent, then I get 403/jersey/checkoutwithoutplayer_id, then it defaults toparent.players[0](backwards-compatible)/jersey/player-infoand/checkout/create-sessionTest Expectations
player_idresolves correct playerplayer_iddefaults to first playerplayer_id(not owned by parent) returns 403pytest tests/ -k "player_id or jersey or checkout"Constraints
player_idmust be optional (Nonedefault) to preserve backwards compatibilityplayer.parent_id == parent.id— no cross-parent accessChecklist
Related
westside-basketball— project this affectsforgejo_admin/westside-landing#196— parent spike issue