GET /api/jersey-public-orders — admin list endpoint #432
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#432
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
Depends on
basketball-api#429(migration 031) ANDbasketball-api#430(POST endpoint createsroutes/jersey_public.py). Part of System B production rollout. Architecture inarch-jersey-intake. Revised 2026-04-10 (three times): migration number corrected to 031; dropped non-existentschemas/target; added explicitlimitcap AC; added dependency on #430.Repo
forgejo_admin/basketball-apiUser Story
As Marcus (admin)
I want an authenticated GET endpoint listing public jersey submissions with filters
So that the westside-landing admin UI can render a review-and-reconcile table
Context
Verified 2026-04-10 against live basketball-api source:
require_admin = require_role("admin")defined atroutes/admin.pyline 48 (also mirrored atroutes/subscriptions.pyline 19). Used asuser: User = Depends(require_admin).schemas/directory exists.routes/jersey_public.pywhich is created by #430, so #430 must merge first (in addition to #429 for the model).File Targets
Files to modify:
src/basketball_api/routes/jersey_public.py— addGET /api/jersey-public-ordersroute (admin-gated). Append the new response schema inline at the top of the file alongside the existingJerseyPublicOrderIn/JerseyPublicOrderCreatedfrom #430.Files the agent should NOT touch:
routes/admin.py— reference only for therequire_adminprimitiveroutes/subscriptions.py— reference only for usage patternroutes/checkout.py— System C, hands offsrc/basketball_api/models.py— already populated by #429routes/jersey_public.pyEndpoint spec
Each item includes: id, submitter_keycloak_sub, player_name, email, team, kq, preferred_number_1/2/3, top_size, short_size, tier, status, linked_parent_id, linked_player_id, reviewed_at, reviewed_by, created_at. Do NOT include
submission_ip— that's internal triage data, not admin UI data.Pydantic schema (inline addition to routes/jersey_public.py)
Keycloak integration
from basketball_api.auth import User, require_role(or reuse if already imported by #430)require_admin = require_role("admin")at module scope if not already presentasync def list_jersey_public_orders(..., user: User = Depends(require_admin), db: Session = Depends(get_db))Acceptance Criteria
created_at DESC, id DESC?status=pendingfilters correctly?from_date=...&to_date=...date range works?limit=10caps rows to 10?limit=1000is clamped to 500 (hard cap)?offset=20&limit=10returns rows 21–30totalrespects status/date filters but NOT limit/offsetstatusvalue → 400from_date/to_date→ 400submitter_keycloak_subfor every itemsubmission_ipTest Expectations
pytest tests/ -k "jersey_public and admin"Constraints
require_admin— do NOT roll new authschemas/directorycreated_at DESC, id DESCChecklist
basketball-apimainRelated
westside-basketball— projectstory:WS-S31— admin public jersey intake linkarch-jersey-intake— architecture docbasketball-api#429(migration 031),basketball-api#430(creates jersey_public.py)routes/admin.pyline 48 forrequire_adminprimitiveroutes/subscriptions.pyfor inline-pydantic + require_admin usage patternScope Review: NEEDS_REFINEMENT
Review note:
review-950-2026-04-10Scope is mostly solid — admin-gate pattern verified in
routes/admin.py(require_admin = require_role("admin")), endpoint spec is complete, 11 AC are testable, no decomposition needed. Two fixable issues and one cascade risk:[BODY] Fixes required before advancing to next_up:
src/basketball_api/schemas/jersey_public.pyfrom File Targets. basketball-api has noschemas/directory — pydantic models live inline in route files (seeroutes/jersey.py). DefineJerseyPublicOrderListIteminline inroutes/jersey_public.py.#430(POST endpoint) to Lineage. T5 "modifies"routes/jersey_public.py, but that file is created by #430, not #429. Current Lineage only lists #429.limitmax cap (spec says max 500 but no AC coverslimit=1000behavior).[SCOPE] Cascade risk on dependency:
#429title claims "Migration 014" butalembic/versions/014_add_password_reset_tokens.pyis already merged. Alembic head is 019.#429must be renumbered to 020+ before it lands, or T5 cannot run. Escalating to Ava.Story WS-S31 existence on
project-westside-basketballuser-stories section was not verified — caller should confirm.