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() data = await request.get_json()
if not data.get("title"): if not data.get("title"):
return jsonify({"error": "title is required"}), 400 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( milestone = await create_milestone(
uid, uid,
project_id, project_id,
title=data["title"], title=data["title"],
description=data.get("description"), description=data.get("description"),
order_index=data.get("order_index", 0), order_index=data.get("order_index", 0),
status=status,
) )
return jsonify(await _milestone_dict(milestone)), 201 return jsonify(await _milestone_dict(milestone)), 201
+4
View File
@@ -38,12 +38,16 @@ async def create_project_route():
data = await request.get_json() data = await request.get_json()
if not data.get("title"): if not data.get("title"):
return jsonify({"error": "title is required"}), 400 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( project = await create_project(
uid, uid,
title=data["title"], title=data["title"],
description=data.get("description", ""), description=data.get("description", ""),
goal=data.get("goal", ""), goal=data.get("goal", ""),
color=data.get("color"), color=data.get("color"),
status=status,
) )
return jsonify(project.to_dict()), 201 return jsonify(project.to_dict()), 201
+2 -1
View File
@@ -17,6 +17,7 @@ async def create_milestone(
title: str, title: str,
description: str | None = None, description: str | None = None,
order_index: int = 0, order_index: int = 0,
status: str = "active",
) -> Milestone: ) -> Milestone:
async with async_session() as session: async with async_session() as session:
milestone = Milestone( milestone = Milestone(
@@ -24,7 +25,7 @@ async def create_milestone(
project_id=project_id, project_id=project_id,
title=title, title=title,
description=description, description=description,
status="active", status=status,
order_index=order_index, order_index=order_index,
) )
session.add(milestone) session.add(milestone)
+2 -1
View File
@@ -17,6 +17,7 @@ async def create_project(
description: str = "", description: str = "",
goal: str = "", goal: str = "",
color: str | None = None, color: str | None = None,
status: str = "active",
) -> Project: ) -> Project:
async with async_session() as session: async with async_session() as session:
project = Project( project = Project(
@@ -25,7 +26,7 @@ async def create_project(
description=description, description=description,
goal=goal, goal=goal,
color=color, color=color,
status="active", status=status,
) )
session.add(project) session.add(project)
await session.commit() await session.commit()