Each child is assigned a unique permanent tv_token on creation. The TV dashboard URL (/tv/:tvToken) and WebSocket (/ws/:tvToken) now use this token instead of the internal DB ID. Existing children are backfilled on startup. README updated to reflect the change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
597 B
Python
29 lines
597 B
Python
from datetime import date
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ChildCreate(BaseModel):
|
|
name: str
|
|
birth_date: date | None = None
|
|
color: str = "#4F46E5"
|
|
|
|
|
|
class ChildUpdate(BaseModel):
|
|
name: str | None = None
|
|
birth_date: date | None = None
|
|
color: str | None = None
|
|
is_active: bool | None = None
|
|
strikes: int | None = Field(None, ge=0, le=3)
|
|
|
|
|
|
class ChildOut(BaseModel):
|
|
id: int
|
|
name: str
|
|
birth_date: date | None
|
|
is_active: bool
|
|
color: str
|
|
strikes: int = 0
|
|
tv_token: int | None = None
|
|
|
|
model_config = {"from_attributes": True}
|