Initial project scaffold
Full-stack homeschool web app with FastAPI backend, Vue 3 frontend, MySQL database, and Docker Compose orchestration. Includes JWT auth, WebSocket real-time TV dashboard, schedule builder, activity logging, and multi-child support. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
0
backend/app/schemas/__init__.py
Normal file
0
backend/app/schemas/__init__.py
Normal file
29
backend/app/schemas/activity.py
Normal file
29
backend/app/schemas/activity.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from datetime import date
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ActivityLogCreate(BaseModel):
|
||||
child_id: int
|
||||
subject_id: int | None = None
|
||||
session_id: int | None = None
|
||||
log_date: date
|
||||
notes: str | None = None
|
||||
duration_minutes: int | None = None
|
||||
|
||||
|
||||
class ActivityLogUpdate(BaseModel):
|
||||
notes: str | None = None
|
||||
duration_minutes: int | None = None
|
||||
subject_id: int | None = None
|
||||
|
||||
|
||||
class ActivityLogOut(BaseModel):
|
||||
id: int
|
||||
child_id: int
|
||||
subject_id: int | None
|
||||
session_id: int | None
|
||||
log_date: date
|
||||
notes: str | None
|
||||
duration_minutes: int | None
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
21
backend/app/schemas/auth.py
Normal file
21
backend/app/schemas/auth.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
|
||||
class RegisterRequest(BaseModel):
|
||||
email: EmailStr
|
||||
password: str
|
||||
full_name: str
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
email: EmailStr
|
||||
password: str
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
|
||||
|
||||
class RefreshRequest(BaseModel):
|
||||
refresh_token: str
|
||||
25
backend/app/schemas/child.py
Normal file
25
backend/app/schemas/child.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from datetime import date
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
class ChildOut(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
birth_date: date | None
|
||||
is_active: bool
|
||||
color: str
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
46
backend/app/schemas/schedule.py
Normal file
46
backend/app/schemas/schedule.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from datetime import time
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class ScheduleBlockCreate(BaseModel):
|
||||
subject_id: int | None = None
|
||||
time_start: time
|
||||
time_end: time
|
||||
label: str | None = None
|
||||
notes: str | None = None
|
||||
order_index: int = 0
|
||||
|
||||
|
||||
class ScheduleBlockOut(BaseModel):
|
||||
id: int
|
||||
subject_id: int | None
|
||||
time_start: time
|
||||
time_end: time
|
||||
label: str | None
|
||||
notes: str | None
|
||||
order_index: int
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ScheduleTemplateCreate(BaseModel):
|
||||
name: str
|
||||
child_id: int | None = None
|
||||
is_default: bool = False
|
||||
blocks: list[ScheduleBlockCreate] = []
|
||||
|
||||
|
||||
class ScheduleTemplateUpdate(BaseModel):
|
||||
name: str | None = None
|
||||
child_id: int | None = None
|
||||
is_default: bool | None = None
|
||||
|
||||
|
||||
class ScheduleTemplateOut(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
child_id: int | None
|
||||
is_default: bool
|
||||
blocks: list[ScheduleBlockOut] = []
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
44
backend/app/schemas/session.py
Normal file
44
backend/app/schemas/session.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from datetime import date, datetime
|
||||
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] = []
|
||||
24
backend/app/schemas/subject.py
Normal file
24
backend/app/schemas/subject.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class SubjectCreate(BaseModel):
|
||||
name: str
|
||||
color: str = "#10B981"
|
||||
icon: str = "📚"
|
||||
|
||||
|
||||
class SubjectUpdate(BaseModel):
|
||||
name: str | None = None
|
||||
color: str | None = None
|
||||
icon: str | None = None
|
||||
is_active: bool | None = None
|
||||
|
||||
|
||||
class SubjectOut(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
color: str
|
||||
icon: str
|
||||
is_active: bool
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
16
backend/app/schemas/user.py
Normal file
16
backend/app/schemas/user.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from pydantic import BaseModel, EmailStr
|
||||
|
||||
|
||||
class UserOut(BaseModel):
|
||||
id: int
|
||||
email: EmailStr
|
||||
full_name: str
|
||||
is_active: bool
|
||||
is_admin: bool
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class UserUpdate(BaseModel):
|
||||
full_name: str | None = None
|
||||
email: EmailStr | None = None
|
||||
Reference in New Issue
Block a user