2e2b0b45fa
Rebuild the dashboard as a Drive-style document management system on top of the existing CaveauAI hybrid RAG pipeline. Backend: - 5 migrations (versions, trash soft-delete, saved searches, categories, audit) - DMS helpers (folder ACL walker, disk storage, audit, version snapshot, XLSX/PPTX/HTML/CSV/MD extractors) - New APIs: folders, document-versions, trash, bulk, preview, saved-searches, categories, diagnostics - Extended APIs: documents (folder_id, soft-delete, ACL filter, sort), upload (9 file types, version-collision detection with replace/new/keep-both, disk persistence), chat-stream (folder scoping + graph related-documents) - 30-day trash purge cron with Qdrant + disk + graph cleanup Frontend: - Drive-style two-pane browser with folder tree, drag-drop, bulk-action bar, right-click context menu, multi-select - New pages: folders (tree + per-folder ACL editor), trash (restore/purge) - Extended pages: upload (folder picker, version-collision modal, 9 file type chips), document (Preview/Versions/Permissions tabs with PDF.js + mammoth.js + audio), index (DMS KPIs + activity feed), settings (live diagnostics ping MariaDB/Qdrant/LiteLLM/FalkorDB/disk), chat (folder scope chips + related-authorities chips) - New CSS (dms.css) + JS bundle (dms.js) exposing window.DBN_DMS - Sidebar nav adds Folders + Trash items All routes return HTTP 200 in local smoke test; all 32 files lint clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
35 lines
1.3 KiB
SQL
35 lines
1.3 KiB
SQL
-- DBN DMS migration 002 — soft-delete trash
|
|
-- Adds deleted_at / deleted_by columns to client_documents and client_folders.
|
|
|
|
-- client_documents.deleted_at
|
|
SET @col_exists := (
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE TABLE_SCHEMA = DATABASE()
|
|
AND TABLE_NAME = 'client_documents' AND COLUMN_NAME = 'deleted_at'
|
|
);
|
|
SET @sql := IF(@col_exists = 0,
|
|
'ALTER TABLE client_documents
|
|
ADD COLUMN deleted_at DATETIME NULL AFTER updated_at,
|
|
ADD COLUMN deleted_by INT UNSIGNED NULL AFTER deleted_at,
|
|
ADD KEY idx_deleted (deleted_at)',
|
|
'SELECT 1');
|
|
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
|
|
|
-- client_folders.deleted_at (folders table may not exist if migration 119 hasn't run; guard table too)
|
|
SET @tbl_exists := (
|
|
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
|
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'client_folders'
|
|
);
|
|
SET @col_exists := IF(@tbl_exists = 0, 1,
|
|
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE TABLE_SCHEMA = DATABASE()
|
|
AND TABLE_NAME = 'client_folders' AND COLUMN_NAME = 'deleted_at')
|
|
);
|
|
SET @sql := IF(@tbl_exists = 1 AND @col_exists = 0,
|
|
'ALTER TABLE client_folders
|
|
ADD COLUMN deleted_at DATETIME NULL,
|
|
ADD COLUMN deleted_by INT UNSIGNED NULL,
|
|
ADD KEY idx_deleted (deleted_at)',
|
|
'SELECT 1');
|
|
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|