AP1.1: Method Registry — product_milestone_driven + Methode wählbar
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 1m23s
Test Suite / lint-backend (push) Successful in 2s
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 12s
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 1m23s
Test Suite / lint-backend (push) Successful in 2s
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 12s
Zweite Built-in-Methode mit meilensteinorientierter NextAction-Strategie, API und UI-Auswahl pro Vorhaben; AP0.10d Validation-Vorlagen. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
95feba6204
commit
fc956d4ceb
27 files changed
+684
-15
No files matched your search
@@ -0,0 +1,62 @@
|
||||
"""Steering API — methods and context (AP1.1)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Optional
|
||||
|
||||
from capabilities import require_capability
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
from services import initiatives as initiative_service
|
||||
from services import steering_context as sc_service
|
||||
from steering.context import get_steering_context_dto
|
||||
from steering.methods.registry import list_methods
|
||||
from tenant_context import TenantContext
|
||||
|
||||
router = APIRouter(prefix="/api/steering", tags=["steering"])
|
||||
|
||||
|
||||
class SteeringContextUpdateRequest(BaseModel):
|
||||
method_key: Optional[
|
||||
Literal["generic_operating", "product_milestone_driven"]
|
||||
] = None
|
||||
|
||||
|
||||
@router.get("/methods")
|
||||
def list_steering_methods(
|
||||
ctx: TenantContext = Depends(require_capability("kairo.initiative.read")),
|
||||
):
|
||||
return [
|
||||
{
|
||||
"key": m.key,
|
||||
"version": m.version,
|
||||
"label": m.label,
|
||||
"description": m.description,
|
||||
"next_action_strategy_key": m.next_action_strategy_key,
|
||||
}
|
||||
for m in list_methods()
|
||||
]
|
||||
|
||||
|
||||
@router.patch("/initiatives/{initiative_id}/context")
|
||||
def patch_initiative_steering_context(
|
||||
initiative_id: str,
|
||||
body: SteeringContextUpdateRequest,
|
||||
ctx: TenantContext = Depends(require_capability("kairo.initiative.manage")),
|
||||
):
|
||||
if not initiative_service.get_initiative(
|
||||
tenant_id=ctx.tenant_id, initiative_id=initiative_id
|
||||
):
|
||||
raise HTTPException(status_code=404, detail="Vorhaben nicht gefunden")
|
||||
if not body.method_key:
|
||||
raise HTTPException(status_code=400, detail="method_key erforderlich")
|
||||
try:
|
||||
sc_service.update_method_key(
|
||||
tenant_id=ctx.tenant_id,
|
||||
initiative_id=initiative_id,
|
||||
method_key=body.method_key,
|
||||
user_id=ctx.user_id,
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc)) from exc
|
||||
return get_steering_context_dto(ctx, initiative_id=initiative_id)
|
||||
Reference in new issue
Block a user