###############################################################################
import fastapi
+import pydantic
from . import apiv1
from . import auth
return mirror
+class EditMirrorRequest(pydantic.BaseModel):
+ # Owner
+ owner: str = ""
+
+ # Contact
+ contact: str = ""
+
+ # Notes
+ notes: str = ""
+
+@router.put("/{hostname}")
+async def edit_mirror(
+ request: EditMirrorRequest,
+ mirror: Mirror = fastapi.Depends(get_mirror_from_path),
+ current_user: User = fastapi.Depends(auth.get_current_admin),
+) -> Mirror:
+ # Update some fields
+ async with backend.db as session:
+ mirror.owner = request.owner
+ mirror.contact = request.contact
+ mirror.notes = request.notes
+
+ # Return the changed mirror
+ return mirror
+
@router.delete("/{hostname}")
async def delete_mirror(
mirror: Mirror = fastapi.Depends(get_mirror_from_path),