fix: coerce null project fields to empty string to avoid NOT NULL violation

This commit is contained in:
2026-04-09 21:34:14 -04:00
parent 7d5611d00b
commit 7a01733334
+1 -1
View File
@@ -88,7 +88,7 @@ async def update_project_route(project_id: int):
uid = get_current_user_id()
data = await request.get_json()
allowed = {"title", "description", "goal", "status", "color"}
fields = {k: v for k, v in data.items() if k in allowed}
fields = {k: (v if v is not None else "") for k, v in data.items() if k in allowed}
if "status" in fields and fields["status"] not in ("active", "paused", "completed", "archived"):
return jsonify({"error": "status must be 'active', 'completed', or 'archived'"}), 400
project = await update_project(uid, project_id, **fields)