diff --git a/api/advent22_api/routers/user.py b/api/advent22_api/routers/user.py index 732118a..daf511d 100644 --- a/api/advent22_api/routers/user.py +++ b/api/advent22_api/routers/user.py @@ -2,7 +2,7 @@ from fastapi import APIRouter, Depends, HTTPException, status from fastapi.responses import StreamingResponse from PIL import Image -from ..core.calendar_config import CalendarConfig, get_calendar_config +from ..core.calendar_config import CalendarConfig, DoorsSaved, get_calendar_config from ..core.depends import get_day_image from ..core.helpers import api_return_image, load_image from ._security import user_can_view_day, user_is_admin @@ -41,3 +41,14 @@ async def get_image_for_day( raise HTTPException(status.HTTP_401_UNAUTHORIZED, "Wie unhöflich!!!") return await api_return_image(image) + + +@router.get("/doors") +async def get_doors( + cal_cfg: CalendarConfig = Depends(get_calendar_config), +) -> DoorsSaved: + """ + User-sichtbare Türchen lesen + """ + + return [door for door in cal_cfg.doors if await user_can_view_day(door.day)] diff --git a/ui/src/components/ConfigView.vue b/ui/src/components/ConfigView.vue index eeb6e22..ec9d336 100644 --- a/ui/src/components/ConfigView.vue +++ b/ui/src/components/ConfigView.vue @@ -18,8 +18,7 @@
{{ config_model.puzzle.solution }}
Offene Türchen
- -
10
+
{{ num_user_doors }}
Nächstes Türchen in
@@ -122,7 +121,7 @@