Schedule data model + migration + seed (practices, events) #232
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#232
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/basketball-api#230(decomposed parent).Repo
forgejo_admin/basketball-apiUser Story
story:WS-S13As an admin, I want schedule data stored in the database so that practices and events are managed programmatically instead of hardcoded HTML.Context
No schedule entities exist in the domain model. This ticket adds the data layer only — models, migration, and seed data. API endpoints are a separate ticket (#233).
Key design decisions (from review of #230):
Division(boys/girls)enum — Kings=boys, Queens=girls. No new enum needed.practice_schedules(recurring weekly) andevents(date-specific). Different data shapes warrant separate tables.String(10)for time fields ("14:00" format) — avoids Time type serialization complexity.events.parent_event_idfor tournament→game nesting.File Targets
Files to create or modify:
src/basketball_api/models.py— addEventTypeenum,PracticeSchedulemodel,Eventmodel. Add relationships toTenantmodel.alembic/versions/xxx_add_schedule_tables.py— migration creating both tablesscripts/seed_schedule.py— populate current hardcoded schedule dataPattern reference (do NOT modify):
src/basketball_api/models.pylines 1-50 for import/enum stylesrc/basketball_api/models.pylines 146-160 for Tenant relationship patternsrc/basketball_api/models.pylines 327-346 for Team model (FK target)Files NOT to touch:
src/basketball_api/routes/*— endpoints are a separate ticketsrc/basketball_api/schemas.py— does not exist, not part of this ticketAcceptance Criteria
EventTypeenum added with values: tournament, game, camp, tryout, otherPracticeSchedulemodel created with columns: id, tenant_id (FK), team_id (FK nullable), division (Enum(Division) nullable), label (String 200), day_of_week (Integer 0-6), start_time (String 10), end_time (String 10), location (String 300), notes (Text nullable), is_active (Boolean default true), created_atEventmodel created with columns: id, tenant_id (FK), title (String 300), event_type (Enum(EventType)), division (Enum(Division) nullable), start_date (Date), end_date (Date nullable), location (String 300 nullable), team_id (FK nullable), parent_event_id (FK self-ref nullable), opponent (String 200 nullable), notes (Text nullable), created_atTest Expectations
pytest tests/ -vConstraints
Mapped[type] = mapped_column()pattern used throughout models.pyserver_default=func.now()for created_at (not Python default)server_default=text("true")for is_active (matches is_public pattern on Player)index=True(matches every other model)practice_schedulesandeventsrelationships to Tenant modelChecklist
Related
forgejo_admin/basketball-api#230forgejo_admin/basketball-api#233(API endpoints)project-westside-basketballarch-domain-westside-basketball— update after mergeScope Review: READY
Review note:
review-629-2026-03-28All template sections present, traceability triangle complete (story:WS-S13, arch:basketball-api, Forgejo #232). All file targets verified against codebase — line references accurate, patterns confirmed, schemas.py absence confirmed.
Minor nit (non-blocking): Constraints section says
server_default=text("true")for is_active "matches is_public pattern on Player" — butPlayer.is_publicdefaults totext("false"). The actual match isProduct.active(line 382). Consider updating the reference text.