From: Michael Tremer Date: Wed, 2 Jul 2025 17:28:51 +0000 (+0000) Subject: api: Add an endpoint to delete mirrors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=072ecbe63c1b1186306aad38dfef0a6d10680210;p=pbs.git api: Add an endpoint to delete mirrors Signed-off-by: Michael Tremer --- diff --git a/src/api/mirrors.py b/src/api/mirrors.py index 47f505aa..971e5b65 100644 --- a/src/api/mirrors.py +++ b/src/api/mirrors.py @@ -50,6 +50,18 @@ async def get_mirror(mirror: Mirror = fastapi.Depends(get_mirror_from_path)) -> return mirror +@router.delete("/{hostname}") +async def delete_mirror( + mirror: Mirror = fastapi.Depends(get_mirror_from_path), + current_user: User = fastapi.Depends(auth.get_current_admin), +) -> fastapi.Response: + # Delete the mirror + async with backend.db as session: + await mirror.delete(deleted_by=current_user) + + # Send 204 + return fastapi.Response(status_code=204) + @router.post("/{hostname}/check") async def check_mirror( mirror: Mirror = fastapi.Depends(get_mirror_from_path),