[Feature] : Add Recycle Bin (Trash / Restore Flow)#544
Open
hrshjswniii wants to merge 6 commits into
Open
Conversation
…resolve schemas conflict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issue
Closes #541
📝 What does this PR do?
This PR implements a dedicated Recycle Bin (Trash / Restore) workflow to allow users to view, restore, or permanently purge their soft-deleted documents:
GET /api/v1/documents/trash: Lists all soft-deleted documents (is_deleted == True) belonging to the user or their active workspaces.POST /api/v1/documents/{document_id}/restore: Restores a soft-deleted document by resettingis_deleted = Falseanddeleted_at = None.DELETE /api/v1/documents/{document_id}/purge: Immediately and permanently deletes the document's database record, physical uploads, vector chunks, and knowledge graph files.cleanup_old_deleted_documentsjob to also purge knowledge graph files (delete_graph) of documents in trash for over 30 days.TrashModal.tsxdisplaying trashed documents with options to restore or permanently purge them.DocumentSidebar.tsxas a trash button next to the "Documents" header./trash,/restore, and/purgeroutes insidetests/test_documents.py.🗂️ Type of Change
🧪 How was this tested?
npx tsc --noEmitcompleted with no compilation errors)The new route
GET /api/v1/documents/trashhas been registered beforeGET /api/v1/documents/{document_id}inbackend/app/routes/documents.pyto prevent route matching conflicts where FastAPI would treat/trashas a document ID.✅ Self-Review Checklist
dev, notmainmainbranch or any HuggingFace deployment config