[1.6] Permanent Delete (Quest/Adventure)

1. Front Matter

  • Title: Permanent Delete (Quest/Adventure)

  • Author: scorevi (Sean Patrick Caintic)

  • Reviewers: dyorgie (Jethro Lagmay)

  • Created: February 2026

  • Status: Approved

  • References:

    • Issue: [1.6] Permanent Delete #28

    • Milestone: [1] Diagnose (Project Setup)


2. Introduction & Goals

  • Problem Summary: Creators need the ability to permanently remove archived projects from the system. This requires explicit confirmation to prevent accidental data loss.

  • Goals:

    • Implement hard-delete for archived projects only

    • Require explicit confirmation (type "DELETE" or project name)

    • Remove all associated data (DB + Storage)

    • Cascade delete to related records

  • Non-Goals:

    • Permanent delete of active projects (must archive first)

    • Undo/recovery after permanent delete

    • Batch permanent delete

  • Glossary:

    • Hard Delete: Irreversible database removal

    • Cascade Delete: Automatic deletion of related records via FK constraints


3. High-Level Architecture

  • System Diagram:

image.png
  • Technologies Used:

    • Server Actions - Delete logic

    • Supabase - Database + Storage

    • Shadcn AlertDialog - Confirmation modal


4. Detailed Design & Implementation

  • Data Model / Schema: Cascade deletions and storage cleanup:

Table

Relationship

Action

quest_skills

FK to quests

CASCADE

quest_comments

FK to quests

CASCADE

quest_invites

FK to quests

CASCADE

content_cards

FK to quests

CASCADE

Storage buckets: quest-assets ({questId}/*), thumbnails ({questId}.*)

  • API Specification:

    • DELETE /api/creator/permanent-delete - Hard delete archived quest

    • Request body: questId (UUID, required), confirmation (string, required - must match "DELETE" or project title)

  • Logic & Workflows: Delete flow:

    1. Click "Delete Forever" - Opens modal

    2. Type confirmation - Must match "DELETE" or title

    3. Click confirm - Only enabled when valid

    4. Delete storage files - quest-assets, thumbnails

    5. Delete DB record - Cascades to related tables

    6. UI refresh - Removed from Trash

  • Key Files:

    • app/api/creator/(content)/permanent-delete/route.ts - Delete API

    • components/creator/PermanentDeleteDialog.tsx - Confirmation UI


5. Infrastructure & Operations

  • Dependencies:

    • Supabase DB - Record deletion

    • Supabase Storage - File cleanup

  • Monitoring & Alerting: Track permanent deletes in logs for audit. No alerts (user-initiated action).

  • Deployment Plan:

    1. Ensure FK CASCADE constraints exist

    2. Deploy API and UI

    3. Test storage cleanup


6. Testing & Quality Assurance

  • Test Strategy:

    • Manual: Full delete flow, confirmation

    • Integration: Cascade verification, storage cleanup

  • Known Limitations:

    • Cannot delete active projects (archive first)

    • No recovery after permanent delete

    • Storage cleanup is best-effort (may leave orphans on error)


7. Maintenance & Support

  • Troubleshooting:

    • "Only archived" error → Must archive before deleting

    • "Confirmation mismatch" → Type exactly "DELETE" or title

    • Orphaned storage files → Manual cleanup via Supabase dashboard

  • Changelog:

    • 1.0 (Feb 2026): Initial implementation


Document Version

1.0 - Approved, Feature deployed to production, 02/23/2026


Was this article helpful?