backend: Pydantic response_models für 5 GET-Endpoints hinzufügen
- health.py: HealthResponse - eigenleben.py: EigenlebenOverviewResponse + SkillTextResponse - chronik.py: ChronikResponse + ChronikItem - wissen.py: WissenListResponse + WissenFileResponse - reminders.py: ReminderListResponse + ReminderOut py_compile bestanden, /docs zeigt neue Schemata. Response-Payloads unverändert — nur Typisierung hinzugefügt.
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
Konsument ist v.a. der Hermes-Agent via mcp_mc.py (reminder_create/list/delete);
|
||||
LAN-only wie alle MC2-Endpoints."""
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from services import reminders
|
||||
|
||||
router = APIRouter(prefix="/api")
|
||||
@@ -16,7 +17,20 @@ class ReminderIn(BaseModel):
|
||||
repeat: str = "" # '' einmalig | daily | weekdays | weekly
|
||||
|
||||
|
||||
@router.get("/reminders")
|
||||
class ReminderOut(BaseModel):
|
||||
id: int
|
||||
text: str
|
||||
next_ts: float
|
||||
repeat: str
|
||||
created_ts: float
|
||||
when_local: str
|
||||
|
||||
|
||||
class ReminderListResponse(BaseModel):
|
||||
items: list[ReminderOut]
|
||||
|
||||
|
||||
@router.get("/reminders", response_model=ReminderListResponse)
|
||||
def list_reminders() -> dict:
|
||||
return {"items": reminders.list_all()}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user