Add GET /codes endpoint, enrich CodeResponse with location_name #14
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?
Lineage
plan-mcd-tracker→ Phase 5 → Playground alignment gap (5d)Repo
forgejo_admin/mcd-tracker-apiUser Story
redeem: I need to see ALL my active codes across all locations in one listhistory: I need codes with location names, not just IDsArchitecture
arch-dataflow-mcd-tracker#flow-3-redeem-bogo— user opens codes page, sees all active codesContext
Playground review found two gaps:
codes.htmlshows all user's codes across all locations, but API only hasGET /locations/{id}/codes(per-location). NeedGET /codesthat lists all codes for the user.codes.htmlshows location name on each code card, butCodeResponseonly haslocation_id. Needlocation_namein the response.File Targets
Files to modify:
src/mcd_tracker_api/routes/locations.py— addGET /codesendpoint (list all user's codes, joined with location)src/mcd_tracker_api/schemas.py— addlocation_nametoCodeResponse, optionally createCodeWithLocationResponsesrc/mcd_tracker_api/main.py— register new route if separate routertests/test_locations.py— tests for GET /codes: list all, filter by status (active/redeemed/expired), user isolationFiles NOT to touch:
Acceptance Criteria
GET /codesreturns all codes for authenticated user across all locationslocation_name(joined from Location table)?status=activefilters to active only (expires_at > now, not redeemed)?status=redeemedfilters to redeemed only?status=expiredfilters to expired only (expires_at <= now)Test Expectations
pytest tests/ -vConstraints
GET /locations/{id}/codesunchanged (backwards compatible)CodeResponseschema with addedlocation_name: str | NonefieldChecklist
Closes #13Related
phase-mcd-tracker-5-core-api— parent phaseplan-mcd-tracker— parent plan