]> git.ipfire.org Git - pbs.git/commitdiff
api: Add endpoint to list all uploads
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jun 2025 18:22:20 +0000 (18:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jun 2025 18:22:20 +0000 (18:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/api/uploads.py

index 797be84f00070dec6d8377dbcf12529c4bd9dec6..f7d0607f7f076ef4dd25da8531dd2b3e58a06cf1 100644 (file)
@@ -20,6 +20,7 @@
 
 import fastapi
 import pydantic
+import typing
 import uuid
 
 from . import apiv1
@@ -98,6 +99,10 @@ async def create(request: UploadRequest,
 
        return upload
 
+@router.get("")
+async def get(current_principal = fastapi.Depends(auth.get_current_principal)) -> typing.List[uploads.Upload]:
+       return [upload async for upload in current_principal.get_uploads()]
+
 @router.get("/{id}")
 async def get(upload: uploads.Upload = fastapi.Depends(get_upload)) -> uploads.Upload:
        return upload