Removed unused files, updated templates, added gpt service and small fixes on Django

This commit is contained in:
2025-11-03 13:02:15 +01:00
parent 96e2377073
commit 212b8d39a9
25 changed files with 861 additions and 492 deletions

View File

@@ -158,14 +158,20 @@ async def revoke_device_certificate(device_id: str):
"""
try:
with get_db_context() as db:
# Get the active (non-revoked) certificate for the device
device_cert = (
db.query(DeviceCertificate).filter(DeviceCertificate.device_id == device_id).first()
db.query(DeviceCertificate)
.filter(
DeviceCertificate.device_id == device_id,
DeviceCertificate.revoked_at.is_(None)
)
.first()
)
if not device_cert:
raise HTTPException(status_code=404, detail="Device certificate not found")
if device_cert.revoked_at:
raise HTTPException(status_code=400, detail="Certificate already revoked")
raise HTTPException(
status_code=404,
detail="No active certificate found for this device"
)
cert_manager.revoke_certificate(device_cert.certificate_pem)