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)