feat(kanban): drag-to-delete trash zone + bulk delete for task cards

Salvages #28125 by @Jpalmer95. Adds:
- Drag-to-delete trash zone in the kanban dashboard
- Bulk delete endpoint with cascading delete_task cleanup
- Frontend updates (drag visual + drop handler)
- Confirmation prompt before delete

Resolved end-of-file test conflict by appending both halves.
This commit is contained in:
Jpalmer95 2026-05-18 21:40:08 -07:00 committed by Teknium
parent e3823657d6
commit dfcf48b476
6 changed files with 266 additions and 14 deletions

View file

@ -3368,6 +3368,29 @@ def delete_archived_task(conn: sqlite3.Connection, task_id: str) -> bool:
return cur.rowcount == 1
def delete_task(conn: sqlite3.Connection, task_id: str) -> bool:
"""Hard-delete a task and cascade to all related rows.
Because the schema does not use ``ON DELETE CASCADE`` foreign keys,
we explicitly delete from child tables first, then the task row.
This keeps the operation atomic (single ``write_txn``).
Returns ``True`` if the task existed and was deleted, ``False``
if the task was not found.
"""
with write_txn(conn):
cur = conn.execute("DELETE FROM tasks WHERE id = ?", (task_id,))
if cur.rowcount != 1:
return False
conn.execute("DELETE FROM task_links WHERE parent_id = ? OR child_id = ?", (task_id, task_id))
conn.execute("DELETE FROM task_comments WHERE task_id = ?", (task_id,))
conn.execute("DELETE FROM task_events WHERE task_id = ?", (task_id,))
conn.execute("DELETE FROM task_runs WHERE task_id = ?", (task_id,))
conn.execute("DELETE FROM kanban_notify_subs WHERE task_id = ?", (task_id,))
recompute_ready(conn)
return True
# ---------------------------------------------------------------------------
# Workspace resolution
# ---------------------------------------------------------------------------