Merge dev to main: Security improvements and comprehensive test infrastructure #39
@@ -365,11 +365,20 @@ async def update_task(
|
|||||||
task = dict(row)
|
task = dict(row)
|
||||||
task["tags"] = json.loads(task["tags"]) if task["tags"] else []
|
task["tags"] = json.loads(task["tags"]) if task["tags"] else []
|
||||||
|
|
||||||
|
# Convert datetime objects to ISO format strings for JSON serialization
|
||||||
|
old_values_for_history = old_values.copy()
|
||||||
|
updates_for_history = updates.copy()
|
||||||
|
for key in ["created_at", "updated_at", "completed_at", "due_date"]:
|
||||||
|
if old_values_for_history.get(key):
|
||||||
|
old_values_for_history[key] = old_values_for_history[key].isoformat()
|
||||||
|
if updates_for_history.get(key):
|
||||||
|
updates_for_history[key] = updates_for_history[key].isoformat()
|
||||||
|
|
||||||
# Log history
|
# Log history
|
||||||
await conn.execute("""
|
await conn.execute("""
|
||||||
INSERT INTO task_history (task_id, action, actor, actor_type, old_value, new_value)
|
INSERT INTO task_history (task_id, action, actor, actor_type, old_value, new_value)
|
||||||
VALUES ($1, $2, $3, $4, $5, $6)
|
VALUES ($1, $2, $3, $4, $5, $6)
|
||||||
""", task_id, "updated", actor, "human", json.dumps(old_values), json.dumps(updates))
|
""", task_id, "updated", actor, "human", json.dumps(old_values_for_history), json.dumps(updates_for_history))
|
||||||
|
|
||||||
return task
|
return task
|
||||||
|
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ async def move_task(
|
|||||||
await opc_db.stop_time_entry(task_id=task_id)
|
await opc_db.stop_time_entry(task_id=task_id)
|
||||||
|
|
||||||
if move.status == "done":
|
if move.status == "done":
|
||||||
updates["completed_at"] = datetime.utcnow()
|
updates["completed_at"] = datetime.utcnow().replace(tzinfo=None)
|
||||||
|
|
||||||
updated_task = await opc_db.update_task(
|
updated_task = await opc_db.update_task(
|
||||||
task_id=task_id,
|
task_id=task_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user