- Admin: per-block "Break Time" checkbox + duration (min) setting; new Break Activities section (global list, same pattern as Morning Routine) - Dashboard: break timer section appears on blocks with break enabled; Start/Pause/Resume/Reset controls work independently of the main timer - TV: left column switches to amber break badge + countdown during break; center column shows configurable Break Activities list - Backend: break_time_enabled/break_time_minutes columns on schedule_blocks (auto-migrated on startup); break_activity_items table + CRUD router; break timer events (break_start/pause/resume/reset) stored as TimerEvents and broadcast via WebSocket; break_activities included in dashboard snapshot and session_update broadcast Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
51 lines
1.5 KiB
Python
51 lines
1.5 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
|
|
break_activities: list[str] = [] # text items shown on TV during break time
|