bug: set_calendar_config nicht "dependable"

This commit is contained in:
Jörn-Michael Miehe 2023-09-08 19:43:53 +00:00
parent 973f7546b6
commit 11daf2bf8b
2 changed files with 4 additions and 5 deletions

View file

@ -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
"""

View file

@ -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)