Adds a per-user Morning Routine item list that appears in the TV dashboard Activities panel during the "Good Morning" countdown (before the first block starts). - morning_routine_items table (auto-created on startup) - CRUD API at /api/morning-routine (auth-required) - Items included in the public DashboardSnapshot so TV gets them without auth - Morning Routine section in Admin page (same add/edit/delete UX as subject options) - TV Activities column shows routine items when no block is active, switches to subject options once a block starts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
from datetime import date, datetime, time
|
|
from pydantic import BaseModel
|
|
from app.schemas.schedule import ScheduleBlockOut
|
|
from app.schemas.child import ChildOut
|
|
|
|
|
|
class SessionStart(BaseModel):
|
|
child_id: int
|
|
template_id: int | None = None
|
|
session_date: date | None = None # defaults to today
|
|
|
|
|
|
class TimerAction(BaseModel):
|
|
event_type: str # start | pause | resume | complete | skip
|
|
block_id: int | None = None
|
|
|
|
|
|
class TimerEventOut(BaseModel):
|
|
id: int
|
|
block_id: int | None
|
|
event_type: str
|
|
occurred_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class DailySessionOut(BaseModel):
|
|
id: int
|
|
child_id: int
|
|
template_id: int | None
|
|
session_date: date
|
|
is_active: bool
|
|
current_block_id: int | None
|
|
current_block: ScheduleBlockOut | None = None
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class DashboardSnapshot(BaseModel):
|
|
"""Public TV dashboard payload — no auth required."""
|
|
session: DailySessionOut | None
|
|
child: ChildOut
|
|
blocks: list[ScheduleBlockOut] = []
|
|
completed_block_ids: list[int] = []
|
|
block_elapsed_seconds: int = 0 # seconds already elapsed for the current block
|
|
is_paused: bool = False # whether the current block's timer is paused
|
|
day_start_time: time | None = None
|
|
day_end_time: time | None = None
|
|
morning_routine: list[str] = [] # text items shown on TV during greeting state
|