]> git.ipfire.org Git - pbs.git/commitdiff
API: Implement deleting uploads
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Jun 2025 09:47:58 +0000 (09:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Jun 2025 09:47:58 +0000 (09:47 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/api/uploads.py

index dc97fc13aeb3234cdf80f9f4f2bcd51b224ffec3..329010e2040d4767cb39758553a903a5d42db2ed 100644 (file)
@@ -59,6 +59,13 @@ async def get_upload(id: uuid.UUID,
 async def get(upload: uploads.Upload = fastapi.Depends(get_upload)) -> uploads.Upload:
        return upload
 
+@router.delete("/{id}")
+async def delete(upload: uploads.Upload = fastapi.Depends(get_upload)):
+       # Delete the upload
+       await upload.delete()
+
+       # Send 204
+       return fastapi.Response(status_code=204)
 
 # Add everything to the app
 app.include_router(router)