From 5694438c96114ee2db4b6618e5c1737edffc9975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Tue, 12 Sep 2023 17:15:44 +0000 Subject: [PATCH] rename DayPartModel -> DayStrModel --- api/advent22_api/routers/admin.py | 15 ++++++++------- ui/src/components/CalendarAssistant.vue | 8 ++++---- ui/src/components/ConfigView.vue | 20 +++----------------- ui/src/lib/api.ts | 4 ++-- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/api/advent22_api/routers/admin.py b/api/advent22_api/routers/admin.py index dd90ce6..59c4fbb 100644 --- a/api/advent22_api/routers/admin.py +++ b/api/advent22_api/routers/admin.py @@ -85,20 +85,21 @@ async def get_config_model( ) -class DayPartModel(BaseModel): +class DayStrModel(BaseModel): day: int - part: str + value: str @router.get("/day_parts") async def get_day_parts( _: None = Depends(require_admin), parts: dict[int, str] = Depends(get_parts), -) -> list[DayPartModel]: - return [ - DayPartModel.model_validate({"day": day, "part": part}) - for day, part in sorted(parts.items()) - ] +) -> list[DayStrModel]: + """ + Zuordnung der Lösungsteile zu den Tagen + """ + + return [DayStrModel(day=day, value=part) for day, part in sorted(parts.items())] @router.get("/doors") diff --git a/ui/src/components/CalendarAssistant.vue b/ui/src/components/CalendarAssistant.vue index 2a35996..2221837 100644 --- a/ui/src/components/CalendarAssistant.vue +++ b/ui/src/components/CalendarAssistant.vue @@ -28,7 +28,7 @@ :key="`part-${index}`" class="tag is-info" > - {{ day_part.day }}: {{ day_part.part.split("").join(", ") }} + {{ day_part.day }}: {{ day_part.value.split("").join(", ") }} @@ -50,7 +50,7 @@