mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-09 03:31:51 -07:00
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:
@@ -217,7 +217,7 @@ Allowed `columnName` values: `devName`, `devOwner`, `devType`, `devVendor`, `dev
|
||||
| Field | Type | Required | Description |
|
||||
|---|---|---|---|
|
||||
| `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):
|
||||
|
||||
|
||||
@@ -585,6 +585,10 @@ def api_device_set_alias(mac, payload=None):
|
||||
|
||||
device_handler = DeviceInstance()
|
||||
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)
|
||||
|
||||
|
||||
|
||||
@@ -417,7 +417,7 @@ class UpdateDeviceColumnRequest(BaseModel):
|
||||
class LockDeviceFieldRequest(BaseModel):
|
||||
"""Request to lock/unlock a device field."""
|
||||
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):
|
||||
@@ -430,7 +430,7 @@ class UnlockDeviceFieldsRequest(BaseModel):
|
||||
None,
|
||||
description="List of field names to unlock. If omitted, all tracked fields will be unlocked"
|
||||
)
|
||||
clear_all: bool = Field(
|
||||
clearAll: bool = Field(
|
||||
False,
|
||||
description="True to clear all sources, False to clear only LOCKED/USER"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user