From 8d883d7b3d7ce67366cecf0962abd462f3a7e41a Mon Sep 17 00:00:00 2001 From: calebyhan Date: Tue, 30 Jun 2026 11:04:21 -0400 Subject: [PATCH] Add GET /api/admin/carousel list route (#166) The admin carousel dashboard called GET /admin/carousel to load submitted slides, but the route didn't exist, causing a 405 that the frontend silently swallowed. Add a list-all route mirroring the pattern used by every other admin router in this codebase. --- backend/app/routers/admin/carousel.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/app/routers/admin/carousel.py b/backend/app/routers/admin/carousel.py index a2a82d1..2cb9d46 100644 --- a/backend/app/routers/admin/carousel.py +++ b/backend/app/routers/admin/carousel.py @@ -1,5 +1,6 @@ """Admin carousel slide CRUD routes. +GET /api/admin/carousel — list all slides (including inactive) POST /api/admin/carousel — create slide PUT /api/admin/carousel/reorder — batch reorder slides by ordered slide_ids list PUT /api/admin/carousel/{id} — update slide fields @@ -26,6 +27,16 @@ ) +@router.get("", response_model=list[CarouselSlideDTO]) +def list_admin_slides( + _current_user: Admin = Depends(get_current_user), + db: Session = Depends(get_db), +): + """List all carousel slides, including inactive ones, ordered by display_order.""" + slides = db.query(CarouselSlide).order_by(CarouselSlide.display_order).all() + return [CarouselSlideDTO.model_validate(s) for s in slides] + + @router.post("", response_model=CarouselSlideDTO, status_code=status.HTTP_201_CREATED) def create_admin_slide( body: CreateCarouselSlideDTO,