fix(escalations): Tenant/User-ID Defaults + Routing-Klarheit
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 32s
CI / test-python-backend-compliance (push) Successful in 30s
CI / test-python-document-crawler (push) Successful in 19s
CI / test-python-dsms-gateway (push) Successful in 16s

- escalations/route.ts: X-Tenant-Id + X-User-Id Default-Header ergaenzt,
  X-User-Id aus Request weitergeleitet
- escalation_routes.py: DEFAULT_TENANT_ID Konstante (9282a473-...) statt 'default'
- test_escalation_routes.py: vollstaendige Test-Suite ergaenzt (+337 Zeilen)
- main.go + escalation_handlers.go: DEPRECATED-Kommentare — UCCA-Escalations
  bleiben fuer Assessment-Review, Haupt-Escalation-System ist Python-Backend

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-06 21:15:02 +01:00
parent 8f3fb84b61
commit a5e4801b09
5 changed files with 371 additions and 10 deletions

View File

@@ -25,6 +25,8 @@ from classroom_engine.database import get_db
logger = logging.getLogger(__name__)
router = APIRouter(prefix="/escalations", tags=["escalations"])
DEFAULT_TENANT_ID = '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e'
# =============================================================================
# Pydantic Schemas
@@ -82,7 +84,7 @@ async def list_escalations(
db: Session = Depends(get_db),
):
"""List escalations with optional filters."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
where_clauses = ["tenant_id = :tenant_id"]
params: Dict[str, Any] = {"tenant_id": tid, "limit": limit, "offset": offset}
@@ -121,10 +123,11 @@ async def list_escalations(
async def create_escalation(
request: EscalationCreate,
tenant_id: Optional[str] = Header(None, alias="x-tenant-id"),
user_id: Optional[str] = Header(None, alias="x-user-id"),
db: Session = Depends(get_db),
):
"""Create a new escalation."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
row = db.execute(
text(
@@ -162,7 +165,7 @@ async def get_stats(
db: Session = Depends(get_db),
):
"""Return counts per status and priority."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
status_rows = db.execute(
text(
@@ -218,7 +221,7 @@ async def get_escalation(
db: Session = Depends(get_db),
):
"""Get a single escalation by ID."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
row = db.execute(
text(
"SELECT * FROM compliance_escalations "
@@ -239,7 +242,7 @@ async def update_escalation(
db: Session = Depends(get_db),
):
"""Update an escalation's fields."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
existing = db.execute(
text(
@@ -282,7 +285,7 @@ async def update_status(
db: Session = Depends(get_db),
):
"""Update only the status of an escalation."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
existing = db.execute(
text(
@@ -322,7 +325,7 @@ async def delete_escalation(
db: Session = Depends(get_db),
):
"""Delete an escalation."""
tid = tenant_id or 'default'
tid = tenant_id or DEFAULT_TENANT_ID
existing = db.execute(
text(