fix: convert datetime objects to ISO strings before JSON serialization in task history
Deploy Dashboard (Dev) / deploy-dev (push) Failing after 1m59s
Run Tests / Backend Tests (push) Failing after 50s
Run Tests / Frontend Tests (push) Has started running
Run Tests / Test Summary (push) Has been cancelled

This commit is contained in:
Gan, Jimmy
2026-04-02 01:38:08 +08:00
parent f2b490e2e8
commit 9f2cd7cab2
+7 -1
View File
@@ -258,11 +258,17 @@ async def create_task(
task = dict(row)
task["tags"] = json.loads(task["tags"]) if task["tags"] else []
# Convert datetime objects to ISO format strings for JSON serialization
task_for_history = task.copy()
for key in ["created_at", "updated_at", "completed_at", "due_date"]:
if task_for_history.get(key):
task_for_history[key] = task_for_history[key].isoformat()
# Log history
await conn.execute("""
INSERT INTO task_history (task_id, action, actor, actor_type, new_value)
VALUES ($1, $2, $3, $4, $5)
""", task["id"], "created", actor, "human", json.dumps(task))
""", task["id"], "created", actor, "human", json.dumps(task_for_history))
return task