diff --git a/api/advent22_api/core/config.py b/api/advent22_api/core/config.py index fe24823..ac8d23c 100644 --- a/api/advent22_api/core/config.py +++ b/api/advent22_api/core/config.py @@ -75,19 +75,15 @@ class TransformedString(BaseModel): class Puzzle(BaseModel): # Titel - # TODO penner neue Route GET /user/title title: str # Tag, an dem der Kalender startet - # TODO penner begin_day: int = 1 # Monat, in dem der Kalender startet - # TODO penner begin_month: int = 12 # Kalender so viele Tage nach der letzten Türöffnung schließen - # TODO penner close_after: int = 90 diff --git a/api/advent22_api/core/depends.py b/api/advent22_api/core/depends.py index 00b45dd..e4d0a3d 100644 --- a/api/advent22_api/core/depends.py +++ b/api/advent22_api/core/depends.py @@ -23,6 +23,7 @@ async def get_all_sorted_days( async def get_all_event_dates( + cfg: Config = Depends(get_config), days: list[int] = Depends(get_all_sorted_days), ) -> EventDates: """ @@ -31,10 +32,10 @@ async def get_all_event_dates( return EventDates( today=date.today(), - begin_month=12, - begin_day=1, + begin_month=cfg.puzzle.begin_month, + begin_day=cfg.puzzle.begin_day, events=days, - close_after=90, + close_after=cfg.puzzle.close_after, ) diff --git a/api/advent22_api/routers/user.py b/api/advent22_api/routers/user.py index 175e221..673c5c1 100644 --- a/api/advent22_api/routers/user.py +++ b/api/advent22_api/routers/user.py @@ -27,6 +27,17 @@ async def get_background_image( return await api_return_image(await load_image(f"files/{cal_cfg.background}")) +@router.get("/title") +async def get_title( + cfg: Config = Depends(get_config), +) -> str: + """ + Lädt Kalendertitel + """ + + return cfg.puzzle.title + + @router.get("/doors") async def get_doors( cal_cfg: CalendarConfig = Depends(get_calendar_config),