bf9c22ab78
IDE-Vorbereiten-Karten bekommen einen 'Konzept'-Knopf: MC2 holt KONZEPT.md aus dem vorbereiteten Gitea-Repo (Gitea-Raw-API + Auth aus git-credentials) und rendert es direkt im Auftragsbuch (leichter MD-Renderer lib/markdown.tsx). So liest der Commander das ausgearbeitete Konzept in der GUI, ohne das Repo aufzumachen (User-Wunsch: 'lesen gehoert in MC2, feilen in die IDE'). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
98 lines
2.4 KiB
Python
98 lines
2.4 KiB
Python
"""Ideen-Queue-Endpoints — dünner REST-Layer über services/ideen.py (natives Hermes-Kanban).
|
|
LAN-only wie alle MC2-Endpoints; das Mensch-Gate bleibt die Karte im Auftragsbuch."""
|
|
|
|
from fastapi import APIRouter, HTTPException
|
|
from pydantic import BaseModel
|
|
|
|
from services import ideen
|
|
|
|
router = APIRouter(prefix="/api")
|
|
|
|
|
|
class IdeeIn(BaseModel):
|
|
titel: str
|
|
notiz: str = ""
|
|
welt: str = "box" # "box" = Werkstatt baut · "ide" = vorbereiten für Zed
|
|
|
|
|
|
class TaskIn(BaseModel):
|
|
id: str
|
|
|
|
|
|
class AntwortIn(BaseModel):
|
|
id: str
|
|
antwort: str
|
|
|
|
|
|
@router.get("/ideen")
|
|
def list_queue() -> dict:
|
|
return ideen.list_queue()
|
|
|
|
|
|
@router.post("/ideen")
|
|
def add_idea(body: IdeeIn) -> dict:
|
|
res = ideen.add_idea(body.titel, body.notiz, welt=body.welt)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Idee konnte nicht angelegt werden."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/antwort")
|
|
def answer(body: AntwortIn) -> dict:
|
|
res = ideen.answer_task(body.id, body.antwort)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Antwort konnte nicht gesendet werden."))
|
|
return res
|
|
|
|
|
|
class PrioIn(BaseModel):
|
|
id: str
|
|
richtung: str # hoch | runter
|
|
|
|
|
|
@router.post("/ideen/stopp")
|
|
def stop(body: TaskIn) -> dict:
|
|
res = ideen.stop_task(body.id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Stoppen fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/retry")
|
|
def retry(body: TaskIn) -> dict:
|
|
res = ideen.retry_task(body.id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Neuer Versuch fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/prio")
|
|
def prio(body: PrioIn) -> dict:
|
|
res = ideen.prio_task(body.id, body.richtung)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Prio-Änderung fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.post("/ideen/archivieren")
|
|
def archive(body: TaskIn) -> dict:
|
|
res = ideen.archive_task(body.id)
|
|
if not res.get("ok"):
|
|
raise HTTPException(400, res.get("error", "Archivieren fehlgeschlagen."))
|
|
return res
|
|
|
|
|
|
@router.get("/ideen/{id}/log")
|
|
def get_log(id: str) -> dict:
|
|
return ideen.log_of(id)
|
|
|
|
|
|
@router.get("/ideen/{id}/ergebnis")
|
|
def get_ergebnis(id: str) -> dict:
|
|
return ideen.ergebnis_of(id)
|
|
|
|
|
|
@router.get("/ideen/{id}/konzept")
|
|
def get_konzept(id: str) -> dict:
|
|
return ideen.konzept_of(id)
|