Kairo-Jinkendo/backend/routers/journey.py
Lars 7e4936a2e4
Some checks failed
Deploy Development / deploy (push) Failing after 37s
Test Suite / pytest-backend (push) Successful in 1m41s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 13s
AP1.6: Plan/Ist-Verknuepfung und Journey-Timeline.
Backlog, Actions, Projects und Tasks koennen Gates zugeordnet werden; Gate-Beitragsliste und chronologische Journey machen Plan/Ist nachvollziehbar.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 08:43:11 +02:00

45 lines
1.6 KiB
Python

"""Plan/Ist & Journey API — AP1.6."""
from __future__ import annotations
from capabilities import require_capability
from fastapi import APIRouter, Depends, HTTPException
from services import plan_ist as plan_ist_service
from tenant_context import TenantContext
initiative_router = APIRouter(prefix="/api/initiatives", tags=["journey"])
roadmap_router = APIRouter(prefix="/api/roadmap-items", tags=["journey"])
@initiative_router.get("/{initiative_id}/journey")
def list_initiative_journey(
initiative_id: str,
ctx: TenantContext = Depends(require_capability("kairo.initiative.read")),
):
try:
events = plan_ist_service.list_journey_events(
tenant_id=ctx.tenant_id, initiative_id=initiative_id
)
except ValueError as exc:
detail = str(exc)
if detail == "Initiative nicht gefunden":
raise HTTPException(status_code=404, detail=detail) from exc
raise HTTPException(status_code=400, detail=detail) from exc
return {"events": events}
@roadmap_router.get("/{roadmap_item_id}/contributions")
def list_gate_contributions(
roadmap_item_id: str,
ctx: TenantContext = Depends(require_capability("kairo.milestone.read")),
):
try:
return plan_ist_service.list_gate_contributions(
tenant_id=ctx.tenant_id, roadmap_item_id=roadmap_item_id
)
except ValueError as exc:
detail = str(exc)
if detail == "Gate nicht gefunden":
raise HTTPException(status_code=404, detail=detail) from exc
raise HTTPException(status_code=400, detail=detail) from exc