fix(storage): PRAGMA foreign_keys=ON; atomic transaction in complete_subtask_and_check_parent; uncomplete_task moved to storage layer
Some checks failed
check / cargo check (macos-latest) (push) Has been cancelled
check / cargo check (ubuntu-22.04) (push) Has been cancelled
check / cargo check (windows-latest) (push) Has been cancelled
check / svelte build + lint (push) Has been cancelled

This commit is contained in:
2026-04-19 11:00:37 +01:00
parent f54d55d110
commit 8c9c9390d8
3 changed files with 42 additions and 23 deletions

View File

@@ -15,6 +15,7 @@ use kon_storage::{
insert_task as db_insert_task,
list_subtasks as db_list_subtasks,
list_tasks as db_list_tasks,
uncomplete_task as db_uncomplete_task,
TaskRow,
};
@@ -113,12 +114,9 @@ pub async fn uncomplete_task_cmd(
state: tauri::State<'_, AppState>,
id: String,
) -> Result<(), String> {
sqlx::query("UPDATE tasks SET done = 0, done_at = NULL WHERE id = ?")
.bind(&id)
.execute(&state.db)
db_uncomplete_task(&state.db, &id)
.await
.map_err(|e| format!("Uncomplete task failed: {e}"))
.map(|_| ())
.map_err(|e| e.to_string())
}
#[tauri::command]