21 lines
609 B
Python
21 lines
609 B
Python
|
|
"""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 []
|