From 11daf2bf8b72e9fcb572518e11579790a38824d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Fri, 8 Sep 2023 19:43:53 +0000 Subject: [PATCH] bug: `set_calendar_config` nicht "dependable" --- api/advent22_api/core/calendar_config.py | 5 +---- api/advent22_api/routers/general.py | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/advent22_api/core/calendar_config.py b/api/advent22_api/core/calendar_config.py index 0e2107e..18949c9 100644 --- a/api/advent22_api/core/calendar_config.py +++ b/api/advent22_api/core/calendar_config.py @@ -41,10 +41,7 @@ class CalendarConfig(BaseModel): txt = await WebDAV.read_str(path=f"files/{cfg.puzzle.calendar}") return CalendarConfig.model_validate(tomllib.loads(txt)) - async def set_calendar_config( - self, - cfg: Config = Depends(Config.get_config), - ) -> None: + async def set_calendar_config(self, cfg: Config) -> None: """ Kalender Konfiguration ändern """ diff --git a/api/advent22_api/routers/general.py b/api/advent22_api/routers/general.py index 2661374..4787624 100644 --- a/api/advent22_api/routers/general.py +++ b/api/advent22_api/routers/general.py @@ -2,6 +2,7 @@ from fastapi import APIRouter, Depends from fastapi.responses import StreamingResponse from ..core.calendar_config import CalendarConfig, DoorsSaved +from ..core.config import Config from ..core.image_helpers import api_return_image, load_image router = APIRouter(prefix="/general", tags=["general"]) @@ -35,6 +36,7 @@ async def get_doors( @router.put("/doors") async def put_doors( doors: DoorsSaved, + cfg: Config = Depends(Config.get_config), cal_cfg: CalendarConfig = Depends(CalendarConfig.get_calendar_config), ) -> None: """ @@ -45,4 +47,4 @@ async def put_doors( doors, key=lambda door: door.day, ) - await cal_cfg.set_calendar_config() + await cal_cfg.set_calendar_config(cfg)