[PR #2489] feat: add soft-delete for projects with 30-day retention #5672

Open
opened 2026-04-16 13:48:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2489
Author: @tink-bot
Created: 3/26/2026
Status: 🔄 Open

Base: mainHead: feat-soft-delete-projects


📝 Commits (6)

  • 49a3cde feat: add database migration for project soft-delete
  • 9aabd37 feat: implement project soft-delete with restore and purge
  • 6c2e2cd feat: add REST endpoints for project restore and deleted listing
  • 56f42a2 fix: exclude soft-deleted projects from all raw SQL queries
  • 86cabee test: add test fixtures and tests for project soft-delete
  • 1dcd27e feat(frontend): add soft-delete UI with Bin page and undo support

📊 Changes

25 files changed (+898 additions, -52 deletions)

View changed files

📝 frontend/src/components/home/Navigation.vue (+10 -0)
📝 frontend/src/i18n/lang/en.json (+16 -6)
📝 frontend/src/modelTypes/IProject.ts (+2 -1)
📝 frontend/src/models/project.ts (+6 -1)
📝 frontend/src/router/index.ts (+5 -0)
📝 frontend/src/services/project.ts (+22 -0)
📝 frontend/src/stores/projects.ts (+26 -0)
frontend/src/views/project/ProjectsBin.vue (+113 -0)
📝 frontend/src/views/project/settings/ProjectSettingsDelete.vue (+12 -3)
📝 pkg/db/fixtures/projects.yml (+36 -0)
📝 pkg/initialize/init.go (+1 -0)
pkg/migration/20260326155123.go (+45 -0)
📝 pkg/models/project.go (+211 -13)
📝 pkg/models/project_permissions.go (+3 -2)
📝 pkg/models/project_repair.go (+3 -1)
pkg/models/project_soft_delete.go (+83 -0)
📝 pkg/models/project_test.go (+183 -18)
📝 pkg/models/subscription.go (+4 -2)
📝 pkg/models/task_overdue_reminder.go (+1 -1)
📝 pkg/models/task_search.go (+2 -2)

...and 5 more files

📄 Description

Deleting a project now soft-deletes it (sets deleted_at) instead of permanently removing it. Soft-deleted projects are invisible everywhere but can be restored within 30 days, after which a background job permanently purges them.

Backend

  • Migration: adds nullable deleted_at column to projects
  • Soft-delete: Project.Delete() sets deleted_at instead of cascading; recursively soft-deletes all descendants via CTE
  • Restore: POST /projects/:id/restore restores a project and its descendants
  • List deleted: GET /projects/deleted returns soft-deleted projects the user owns
  • Purge job: hourly cron permanently deletes projects past 30-day retention using PermanentDelete()
  • Raw SQL fixes: 12 query sites updated with deleted_at IS NULL filters (project listing, permissions CTE, subscriptions, overdue reminders, task search, etc.)
  • User deletion: uses PermanentDelete() so account removal still fully cleans up

Frontend

  • Bin page (/projects/bin) showing deleted projects with restore button and days remaining
  • Bin link in sidebar navigation
  • Delete modal uses softer language ("move to bin", "permanently deleted after 30 days")
  • Undo toast after deleting a project

Test plan

  • Verify the Bin page loads and shows soft-deleted projects
  • Delete a project and confirm the undo toast restores it
  • Check that soft-deleted projects don't appear in sidebar, task lists, or search

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2489 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 3/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat-soft-delete-projects` --- ### 📝 Commits (6) - [`49a3cde`](https://github.com/go-vikunja/vikunja/commit/49a3cde3ac43c0696ba78861f76f19ef7f088024) feat: add database migration for project soft-delete - [`9aabd37`](https://github.com/go-vikunja/vikunja/commit/9aabd37b5d7367f0eb0262677988c25439d4aa49) feat: implement project soft-delete with restore and purge - [`6c2e2cd`](https://github.com/go-vikunja/vikunja/commit/6c2e2cda4f52cee98c416396f0ee4aeaea5d3d91) feat: add REST endpoints for project restore and deleted listing - [`56f42a2`](https://github.com/go-vikunja/vikunja/commit/56f42a293cc8593e1d2dba17989ff03dd9ec22fa) fix: exclude soft-deleted projects from all raw SQL queries - [`86cabee`](https://github.com/go-vikunja/vikunja/commit/86cabee5c63e279d99cfb6041c2dd2b336c41c0a) test: add test fixtures and tests for project soft-delete - [`1dcd27e`](https://github.com/go-vikunja/vikunja/commit/1dcd27e56679831301778409b8b32111cd92cfee) feat(frontend): add soft-delete UI with Bin page and undo support ### 📊 Changes **25 files changed** (+898 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/components/home/Navigation.vue` (+10 -0) 📝 `frontend/src/i18n/lang/en.json` (+16 -6) 📝 `frontend/src/modelTypes/IProject.ts` (+2 -1) 📝 `frontend/src/models/project.ts` (+6 -1) 📝 `frontend/src/router/index.ts` (+5 -0) 📝 `frontend/src/services/project.ts` (+22 -0) 📝 `frontend/src/stores/projects.ts` (+26 -0) ➕ `frontend/src/views/project/ProjectsBin.vue` (+113 -0) 📝 `frontend/src/views/project/settings/ProjectSettingsDelete.vue` (+12 -3) 📝 `pkg/db/fixtures/projects.yml` (+36 -0) 📝 `pkg/initialize/init.go` (+1 -0) ➕ `pkg/migration/20260326155123.go` (+45 -0) 📝 `pkg/models/project.go` (+211 -13) 📝 `pkg/models/project_permissions.go` (+3 -2) 📝 `pkg/models/project_repair.go` (+3 -1) ➕ `pkg/models/project_soft_delete.go` (+83 -0) 📝 `pkg/models/project_test.go` (+183 -18) 📝 `pkg/models/subscription.go` (+4 -2) 📝 `pkg/models/task_overdue_reminder.go` (+1 -1) 📝 `pkg/models/task_search.go` (+2 -2) _...and 5 more files_ </details> ### 📄 Description Deleting a project now soft-deletes it (sets `deleted_at`) instead of permanently removing it. Soft-deleted projects are invisible everywhere but can be restored within 30 days, after which a background job permanently purges them. ### Backend - **Migration**: adds nullable `deleted_at` column to `projects` - **Soft-delete**: `Project.Delete()` sets `deleted_at` instead of cascading; recursively soft-deletes all descendants via CTE - **Restore**: `POST /projects/:id/restore` restores a project and its descendants - **List deleted**: `GET /projects/deleted` returns soft-deleted projects the user owns - **Purge job**: hourly cron permanently deletes projects past 30-day retention using `PermanentDelete()` - **Raw SQL fixes**: 12 query sites updated with `deleted_at IS NULL` filters (project listing, permissions CTE, subscriptions, overdue reminders, task search, etc.) - **User deletion**: uses `PermanentDelete()` so account removal still fully cleans up ### Frontend - Bin page (`/projects/bin`) showing deleted projects with restore button and days remaining - Bin link in sidebar navigation - Delete modal uses softer language ("move to bin", "permanently deleted after 30 days") - Undo toast after deleting a project ## Test plan - Verify the Bin page loads and shows soft-deleted projects - Delete a project and confirm the undo toast restores it - Check that soft-deleted projects don't appear in sidebar, task lists, or search --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 13:48:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#5672