Update API documentation and schemas: clarify lock/unlock behavior for device fields and enhance error handling in device alias update

This commit is contained in:
Jokob @NetAlertX
2026-04-08 22:38:43 +00:00
parent 28e6d62ccb
commit da8b694a49
3 changed files with 7 additions and 3 deletions

View File

@@ -217,7 +217,7 @@ Allowed `columnName` values: `devName`, `devOwner`, `devType`, `devVendor`, `dev
| Field | Type | Required | Description | | Field | Type | Required | Description |
|---|---|---|---| |---|---|---|---|
| `fieldName` | string | ✅ | Field to lock/unlock (e.g. `devName`, `devVendor`) | | `fieldName` | string | ✅ | Field to lock/unlock (e.g. `devName`, `devVendor`) |
| `lock` | boolean | ❌ | `true` to lock (default), `false` to unlock | | `lock` | boolean | ❌ | `true` to lock, `false` to unlock (default when omitted) |
**Response** (success): **Response** (success):

View File

@@ -585,6 +585,10 @@ def api_device_set_alias(mac, payload=None):
device_handler = DeviceInstance() device_handler = DeviceInstance()
result = device_handler.updateDeviceColumn(mac, 'devName', alias) result = device_handler.updateDeviceColumn(mac, 'devName', alias)
if not result.get("success") and result.get("error") == "Device not found":
return jsonify(result), 404
return jsonify(result) return jsonify(result)

View File

@@ -417,7 +417,7 @@ class UpdateDeviceColumnRequest(BaseModel):
class LockDeviceFieldRequest(BaseModel): class LockDeviceFieldRequest(BaseModel):
"""Request to lock/unlock a device field.""" """Request to lock/unlock a device field."""
fieldName: str = Field(..., description="Field name to lock/unlock (e.g., devName, devVendor). Required.") fieldName: str = Field(..., description="Field name to lock/unlock (e.g., devName, devVendor). Required.")
lock: bool = Field(True, description="True to lock the field, False to unlock") lock: bool = Field(False, description="True to lock the field, False (default) to unlock")
class UnlockDeviceFieldsRequest(BaseModel): class UnlockDeviceFieldsRequest(BaseModel):
@@ -430,7 +430,7 @@ class UnlockDeviceFieldsRequest(BaseModel):
None, None,
description="List of field names to unlock. If omitted, all tracked fields will be unlocked" description="List of field names to unlock. If omitted, all tracked fields will be unlocked"
) )
clear_all: bool = Field( clearAll: bool = Field(
False, False,
description="True to clear all sources, False to clear only LOCKED/USER" description="True to clear all sources, False to clear only LOCKED/USER"
) )