✨feature: Add editable hostname and operating system
Release / Build and Push Docker Image (push) Successful in 4m56s
Release / Build and Push Docker Image (push) Successful in 4m56s
This commit is contained in:
+13
@@ -19,6 +19,7 @@ from .service import (
|
||||
fetch_scans,
|
||||
mark_missing_devices,
|
||||
scan_state,
|
||||
update_device_identity,
|
||||
upsert_host,
|
||||
)
|
||||
|
||||
@@ -60,6 +61,18 @@ def api_device(device_id: int) -> dict:
|
||||
return device
|
||||
|
||||
|
||||
@app.patch("/api/devices/{device_id}")
|
||||
def api_update_device(device_id: int, payload: dict[str, Any]) -> dict:
|
||||
device = update_device_identity(
|
||||
device_id,
|
||||
str(payload.get("hostname") or ""),
|
||||
str(payload.get("os_name") or ""),
|
||||
)
|
||||
if not device:
|
||||
raise HTTPException(status_code=404, detail="Device not found")
|
||||
return device
|
||||
|
||||
|
||||
@app.get("/api/scans")
|
||||
def api_scans(limit: int = 20) -> list[dict]:
|
||||
return fetch_scans(limit=limit)
|
||||
|
||||
Reference in New Issue
Block a user