feat: add schedule data model (PracticeSchedule, Event, EventType) #234
No reviewers
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!234
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "232-schedule-data-model"
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?
Summary
Adds the data layer for schedule management:
EventTypeenum,PracticeSchedulemodel (recurring weekly slots), andEventmodel (date-specific tournaments/games/camps/tryouts) with self-referencing FK for tournament-to-game nesting. Includes migration, seed script (8 Kings practices, 3 Kings tournaments, 5 Queens tournaments), and comprehensive tests.Changes
src/basketball_api/models.py-- AddedEventTypeenum (tournament, game, camp, tryout, other),PracticeSchedulemodel,Eventmodel with self-referencingparent_event_idFK, andpractice_schedules/eventsrelationships onTenantalembic/env.py-- AddedEventandPracticeScheduleimports for migration metadataalembic/versions/029_add_schedule_tables.py-- Migration creatingpractice_schedulesandeventstables with indexes,eventtypeenum, and clean downgradescripts/seed_schedule.py-- Idempotent seed script populating current hardcoded schedule datatests/test_schedule.py-- 15 tests covering enum values, model CRUD, nullable fields, self-referencing FK, tenant relationships, table existence, and seed idempotencyTest Plan
pytest tests/ -v-- 655 tests pass (15 new schedule tests + all existing)Review Checklist
Mapped[type] = mapped_column()patternserver_default=func.now()for created_atserver_default=text("true")for is_active (matches is_public on Player)index=Trueon both tablesRelated Notes
Related
QA Review -- PR #234
Acceptance Criteria Verification
EventTypeenum with values: tournament, game, camp, tryout, otherPracticeSchedulemodel with all specified columnsEventmodel with all specified columnsConstraint Compliance
Mapped[type] = mapped_column()patternserver_default=func.now()for created_atserver_default=text("true")for is_activeindex=Trueon both tablespractice_schedulesandeventsrelationships on TenantTest Coverage
test_schedule.pyMigration Review
eventtypeenum created withcheckfirst=Truein upgradeeventtypeenum dropped withcheckfirst=Truein downgradedivisionenum withcreate_constraint=False-- correctFindings
No issues found. Implementation matches the issue spec (#232) exactly across all acceptance criteria and constraints.
VERDICT: APPROVED