kin: KIN-UI-015-backend_dev

This commit is contained in:
Gros Frumos 2026-03-18 15:45:43 +02:00
parent 56c3fe6ecc
commit 34c57bef86
2 changed files with 43 additions and 2 deletions

View file

@ -654,6 +654,28 @@ def start_project_phase(project_id: str):
# Tasks
# ---------------------------------------------------------------------------
@app.get("/api/tasks")
def list_tasks(
status: str | None = Query(default=None),
limit: int = Query(default=20, ge=1, le=500),
sort: str = Query(default="updated_at"),
project_id: str | None = Query(default=None),
):
"""List tasks with optional filters. sort defaults to updated_at desc."""
from core.models import VALID_TASK_SORT_FIELDS
conn = get_conn()
tasks = models.list_tasks(
conn,
project_id=project_id,
status=status,
limit=limit,
sort=sort if sort in VALID_TASK_SORT_FIELDS else "updated_at",
sort_dir="desc",
)
conn.close()
return tasks
@app.get("/api/tasks/{task_id}")
def get_task(task_id: str):
conn = get_conn()