fix: allow 'paused' in project status validation
This commit is contained in:
@@ -52,7 +52,7 @@ async def create_project_route():
|
|||||||
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")
|
status = data.get("status", "active")
|
||||||
if status not in ("active", "completed", "archived"):
|
if status not in ("active", "paused", "completed", "archived"):
|
||||||
return jsonify({"error": "status must be 'active', 'completed', or 'archived'"}), 400
|
return jsonify({"error": "status must be 'active', 'completed', or 'archived'"}), 400
|
||||||
project = await create_project(
|
project = await create_project(
|
||||||
uid,
|
uid,
|
||||||
@@ -89,7 +89,7 @@ async def update_project_route(project_id: int):
|
|||||||
data = await request.get_json()
|
data = await request.get_json()
|
||||||
allowed = {"title", "description", "goal", "status", "color"}
|
allowed = {"title", "description", "goal", "status", "color"}
|
||||||
fields = {k: v for k, v in data.items() if k in allowed}
|
fields = {k: v for k, v in data.items() if k in allowed}
|
||||||
if "status" in fields and fields["status"] not in ("active", "completed", "archived"):
|
if "status" in fields and fields["status"] not in ("active", "paused", "completed", "archived"):
|
||||||
return jsonify({"error": "status must be 'active', 'completed', or 'archived'"}), 400
|
return jsonify({"error": "status must be 'active', 'completed', or 'archived'"}), 400
|
||||||
project = await update_project(uid, project_id, **fields)
|
project = await update_project(uid, project_id, **fields)
|
||||||
if project is None:
|
if project is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user