kin: KIN-072 Добавить kanban вид в таски проекта. Канбан добавлен и работает.

This commit is contained in:
Gros Frumos 2026-03-16 09:58:51 +02:00
parent 5970118d12
commit 389b266bee
3 changed files with 10 additions and 2 deletions

View file

@ -501,6 +501,7 @@ class TaskCreate(BaseModel):
priority: int = 5
route_type: str | None = None
category: str | None = None
acceptance_criteria: str | None = None
@app.post("/api/tasks")
@ -519,7 +520,8 @@ def create_task(body: TaskCreate):
task_id = models.next_task_id(conn, body.project_id, category=category)
brief = {"route_type": body.route_type} if body.route_type else None
t = models.create_task(conn, task_id, body.project_id, body.title,
priority=body.priority, brief=brief, category=category)
priority=body.priority, brief=brief, category=category,
acceptance_criteria=body.acceptance_criteria)
conn.close()
return t
@ -534,6 +536,7 @@ class TaskPatch(BaseModel):
route_type: str | None = None
title: str | None = None
brief_text: str | None = None
acceptance_criteria: str | None = None
VALID_STATUSES = set(models.VALID_TASK_STATUSES)
@ -552,7 +555,7 @@ def patch_task(task_id: str, body: TaskPatch):
raise HTTPException(400, f"Invalid route_type '{body.route_type}'. Must be one of: {', '.join(sorted(VALID_ROUTE_TYPES))} or empty string to clear")
if body.title is not None and not body.title.strip():
raise HTTPException(400, "title must not be empty")
all_none = all(v is None for v in [body.status, body.execution_mode, body.priority, body.route_type, body.title, body.brief_text])
all_none = all(v is None for v in [body.status, body.execution_mode, body.priority, body.route_type, body.title, body.brief_text, body.acceptance_criteria])
if all_none:
raise HTTPException(400, "Nothing to update.")
conn = get_conn()
@ -581,6 +584,8 @@ def patch_task(task_id: str, body: TaskPatch):
if body.brief_text is not None:
current_brief = {**current_brief, "text": body.brief_text}
fields["brief"] = current_brief if current_brief else None
if body.acceptance_criteria is not None:
fields["acceptance_criteria"] = body.acceptance_criteria
models.update_task(conn, task_id, **fields)
t = models.get_task(conn, task_id)
conn.close()