feat: data-driven +page.server.ts with config merge logic #36
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
Sub-ticket of
forgejo_admin/westside-contracts#34— data-driven contract rendering system. Wave 2 (depends on basketball-api migrations).Repo
forgejo_admin/westside-contractsUser Story
As the contract page, I need to load structured contract configuration from the database and merge team defaults with player overrides so that components can render from data instead of hardcoded HTML.
Context
The current +page.server.ts runs a simple query joining players/teams/parents and derives
isLocal/isGirlsfrom the team name. After the basketball-api migrations addteams.contract_configandplayers.contract_overridesJSONB columns, this file needs to load both, merge them (team base + player overrides), and pass a structured config object to the page.Merge rules:
monthly_fee: player column → team config default → 200tournaments: if override has tournament IDs array, filter team tournaments to only those IDspractices: override replaces entirelypayments: override replaces entirelysections: shallow merge (override wins per key)note: from override (player-level custom note)contract_configis NULL: return null config, page falls back to hardcoded renderingFile Targets
src/routes/contract/[token]/+page.server.ts— update query to SELECT contract_config and contract_overrides, add merge logicsrc/lib/types.ts— add ContractConfig, ContractOverrides, MergedConfig TypeScript interfacesFiles NOT to touch:
src/lib/db.ts,src/lib/minio.ts,src/lib/validation.tssrc/routes/contract/[token]/sign/+server.ts— separate ticketsrc/app.cssAcceptance Criteria
t.contract_configandp.contract_overridesconfigis null (triggers fallback rendering)["mesa-az", "nike-vegas"]returns only those 2 tournaments from team's 5{roster_flexibility: false}disables that section while keeping othersnpm run checkpassesTest Expectations
npm test && npm run checkConstraints
src/lib/contract-config.ts) for testabilityChecklist
Related
westside-basketball— parent projectforgejo_admin/westside-contracts#34— parent issueScope Review: READY
Review note:
review-776-2026-04-03Scope is solid — all template sections present, traceability complete (story:WS-S23 verified on project page, arch note exists), both file targets verified in codebase, dependencies documented and wave-ordered correctly. No decomposition needed.
Agent picked up this ticket.