bug: set_calendar_config
nicht "dependable"
This commit is contained in:
parent
973f7546b6
commit
11daf2bf8b
2 changed files with 4 additions and 5 deletions
|
@ -41,10 +41,7 @@ class CalendarConfig(BaseModel):
|
||||||
txt = await WebDAV.read_str(path=f"files/{cfg.puzzle.calendar}")
|
txt = await WebDAV.read_str(path=f"files/{cfg.puzzle.calendar}")
|
||||||
return CalendarConfig.model_validate(tomllib.loads(txt))
|
return CalendarConfig.model_validate(tomllib.loads(txt))
|
||||||
|
|
||||||
async def set_calendar_config(
|
async def set_calendar_config(self, cfg: Config) -> None:
|
||||||
self,
|
|
||||||
cfg: Config = Depends(Config.get_config),
|
|
||||||
) -> None:
|
|
||||||
"""
|
"""
|
||||||
Kalender Konfiguration ändern
|
Kalender Konfiguration ändern
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,6 +2,7 @@ from fastapi import APIRouter, Depends
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
|
|
||||||
from ..core.calendar_config import CalendarConfig, DoorsSaved
|
from ..core.calendar_config import CalendarConfig, DoorsSaved
|
||||||
|
from ..core.config import Config
|
||||||
from ..core.image_helpers import api_return_image, load_image
|
from ..core.image_helpers import api_return_image, load_image
|
||||||
|
|
||||||
router = APIRouter(prefix="/general", tags=["general"])
|
router = APIRouter(prefix="/general", tags=["general"])
|
||||||
|
@ -35,6 +36,7 @@ async def get_doors(
|
||||||
@router.put("/doors")
|
@router.put("/doors")
|
||||||
async def put_doors(
|
async def put_doors(
|
||||||
doors: DoorsSaved,
|
doors: DoorsSaved,
|
||||||
|
cfg: Config = Depends(Config.get_config),
|
||||||
cal_cfg: CalendarConfig = Depends(CalendarConfig.get_calendar_config),
|
cal_cfg: CalendarConfig = Depends(CalendarConfig.get_calendar_config),
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -45,4 +47,4 @@ async def put_doors(
|
||||||
doors,
|
doors,
|
||||||
key=lambda door: door.day,
|
key=lambda door: door.day,
|
||||||
)
|
)
|
||||||
await cal_cfg.set_calendar_config()
|
await cal_cfg.set_calendar_config(cfg)
|
||||||
|
|
Loading…
Reference in a new issue