Skip to content

Add soft delete and trash functionality for tasks#4

Open
rightson wants to merge 1 commit into
mainfrom
claude/add-task-trash-feature-FKsVw
Open

Add soft delete and trash functionality for tasks#4
rightson wants to merge 1 commit into
mainfrom
claude/add-task-trash-feature-FKsVw

Conversation

@rightson

@rightson rightson commented Mar 6, 2026

Copy link
Copy Markdown
Owner

Summary

Implement a soft delete system for tasks with a dedicated trash view, allowing users to recover deleted tasks before permanent deletion.

Key Changes

Backend (Server)

  • Modified DELETE /tasks/:id to perform soft delete by setting deletedAt timestamp instead of removing the record
  • Added POST /tasks/:id/restore endpoint to restore trashed tasks by clearing the deletedAt field
  • Added DELETE /tasks/:id/permanent endpoint for permanent deletion from trash
  • Added GET /tasks/project/:projectId/trash endpoint to fetch all trashed tasks for a project
  • Updated GET /tasks/project/:projectId to exclude soft-deleted tasks (where deletedAt is null)
  • Added deletedAt column to tasks table schema and migration

Frontend (Client)

  • Created new TrashView component displaying trashed tasks with restore and permanent delete actions
  • Updated TaskCard interface to include optional deletedAt field
  • Extended useTaskStore with:
    • trashedTasks state to track deleted tasks
    • fetchTrashedTasks() to load trashed tasks for current project
    • restoreTask() to recover a task from trash
    • permanentDeleteTask() to permanently remove a task
  • Added trash button to ProjectSelector component that opens the trash view
  • Updated App.tsx to manage trash view visibility state
  • Changed delete confirmation message in TaskModal from "Delete this task?" to "Move this task to trash?"

Implementation Details

  • Soft deletes use ISO timestamp strings in the deletedAt column
  • Trashed tasks are visually separated and show deletion date
  • Restore action moves tasks back to active list and clears deletedAt
  • Permanent delete is irreversible and requires confirmation
  • Trash view is modal-based with overlay and displays task priority and color indicators

https://claude.ai/code/session_01QPG5sRrFdNju5qivq3uWwK

Instead of permanently deleting tasks, they are now soft-deleted by
setting a deletedAt timestamp. Deleted tasks are hidden from the canvas
and can be viewed in a trash panel accessible from the toolbar. Users
can restore tasks back to the canvas or permanently delete them.

Changes:
- Add deletedAt column to tasks schema and migration
- Convert DELETE endpoint to soft-delete (sets deletedAt)
- Add trash list, restore, and permanent delete API endpoints
- Filter soft-deleted tasks from project task queries
- Add TrashView component with restore and permanent delete actions
- Add trash button to project toolbar
- Update task store with trash state management

https://claude.ai/code/session_01QPG5sRrFdNju5qivq3uWwK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants