fix: honour status param on project and milestone creation

create_project and create_milestone hardcoded status="active" and
ignored any value passed by the MCP or API callers. Route, service,
and model construction now all thread the status field through.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-29 15:19:50 -04:00
parent 218f946e48
commit 0cbeb6b7ac
4 changed files with 12 additions and 2 deletions
+4
View File
@@ -50,12 +50,16 @@ async def create_milestone_route(project_id: int):
data = await request.get_json()
if not data.get("title"):
return jsonify({"error": "title is required"}), 400
status = data.get("status", "active")
if status not in ("active", "done"):
return jsonify({"error": "status must be 'active' or 'done'"}), 400
milestone = await create_milestone(
uid,
project_id,
title=data["title"],
description=data.get("description"),
order_index=data.get("order_index", 0),
status=status,
)
return jsonify(await _milestone_dict(milestone)), 201
+4
View File
@@ -38,12 +38,16 @@ async def create_project_route():
data = await request.get_json()
if not data.get("title"):
return jsonify({"error": "title is required"}), 400
status = data.get("status", "active")
if status not in ("active", "archived"):
return jsonify({"error": "status must be 'active' or 'archived'"}), 400
project = await create_project(
uid,
title=data["title"],
description=data.get("description", ""),
goal=data.get("goal", ""),
color=data.get("color"),
status=status,
)
return jsonify(project.to_dict()), 201
+2 -1
View File
@@ -17,6 +17,7 @@ async def create_milestone(
title: str,
description: str | None = None,
order_index: int = 0,
status: str = "active",
) -> Milestone:
async with async_session() as session:
milestone = Milestone(
@@ -24,7 +25,7 @@ async def create_milestone(
project_id=project_id,
title=title,
description=description,
status="active",
status=status,
order_index=order_index,
)
session.add(milestone)
+2 -1
View File
@@ -17,6 +17,7 @@ async def create_project(
description: str = "",
goal: str = "",
color: str | None = None,
status: str = "active",
) -> Project:
async with async_session() as session:
project = Project(
@@ -25,7 +26,7 @@ async def create_project(
description=description,
goal=goal,
color=color,
status="active",
status=status,
)
session.add(project)
await session.commit()