From: Michael Tremer Date: Mon, 16 Jun 2025 17:14:04 +0000 (+0000) Subject: API: Create a separate router for uploads X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfe7e801aa7fd4d6c693aa5b0b4a80ada8f39670;p=pbs.git API: Create a separate router for uploads Signed-off-by: Michael Tremer --- diff --git a/src/api/uploads.py b/src/api/uploads.py index f1408528..0b7221eb 100644 --- a/src/api/uploads.py +++ b/src/api/uploads.py @@ -26,7 +26,13 @@ from . import backend from .. import uploads -@app.get("/uploads/{id}") +# Create a new router for all upload endpoints +router = fastapi.APIRouter( + prefix="/uploads", + tags=["Uploads"], +) + +@router.get("/{id}") async def get(id: uuid.UUID) -> uploads.Upload: upload = await backend.uploads.get_by_uuid(id) @@ -35,3 +41,6 @@ async def get(id: uuid.UUID) -> uploads.Upload: raise fastapi.HTTPException(404, "Upload not found") return upload + +# Add everything to the app +app.include_router(router)