feat: Implement focus area usage types management in API and UI
- Added endpoints for listing and updating focus area usage types in the backend. - Enhanced the AdminFocusAreasPage to display and manage allowed usage types for focus areas. - Introduced a new state for usage types catalog and integrated it into the focus area editing process. - Updated API utility functions to support new usage types operations.
This commit is contained in:
1 parent
49e9c9c214
commit
e7dedd527f
6 files changed
+435
-16
No files matched your search
@@ -0,0 +1,20 @@
|
||||
"""Kleine Helfer für Focus-Area-Nutzungstypen (ohne Router-/Auth-Abhängigkeiten)."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any, List
|
||||
|
||||
|
||||
def coerce_usage_type_keys(raw: Any) -> List[str]:
|
||||
"""json_agg / JSON-Spalte zu list[str] normalisieren."""
|
||||
if raw is None:
|
||||
return []
|
||||
if isinstance(raw, list):
|
||||
return [str(x) for x in raw]
|
||||
if isinstance(raw, str):
|
||||
try:
|
||||
data = json.loads(raw)
|
||||
return [str(x) for x in data] if isinstance(data, list) else []
|
||||
except json.JSONDecodeError:
|
||||
return []
|
||||
return []
|
||||
Reference in new issue
Block a user