Implement Permanent File Deletion for Document Endpoints#240
Implement Permanent File Deletion for Document Endpoints#240AkhileshNegi merged 8 commits intomainfrom
Conversation
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
| def aws_credentials(): | ||
| os.environ["AWS_ACCESS_KEY_ID"] = "testing" | ||
| os.environ["AWS_SECRET_ACCESS_KEY"] = "testing" | ||
| os.environ["AWS_SECURITY_TOKEN"] = "testing" | ||
| os.environ["AWS_SESSION_TOKEN"] = "testing" | ||
| os.environ["AWS_DEFAULT_REGION"] = settings.AWS_DEFAULT_REGION |
There was a problem hiding this comment.
I think at some point we also need to create .env.test as we add more testcases that may need similar behaviour.
As this is duplicate from backend/app/tests/api/routes/documents/test_route_document_upload.py
There was a problem hiding this comment.
Agreed.
For the time being, we can go with this way.
| a_crud = OpenAIAssistantCrud() | ||
| d_crud = DocumentCrud(session, current_user.id) | ||
| c_crud = CollectionCrud(session, current_user.id) |
There was a problem hiding this comment.
not a big fan of these names like a_crud, d_crud, I raised same in jerome's PR also but don't know what's the best way to do in OOPs
There was a problem hiding this comment.
@AkhileshNegi that's right,
But this is something used across the document module to keep things consistent across module I used this way
6973b06 to
cbb95bd
Compare
| @@ -0,0 +1,5 @@ | |||
| This operation soft deletes the document — meaning its metadata and reference are retained in the database, but it is marked as deleted. The actual file stored in cloud storage (e.g., S3) is permanently deleted, and this action is irreversible. | |||
There was a problem hiding this comment.
Not a very significant change but the line where it states that the file gets permanently deleted from S3 should come as the first line
Summary
Target issue #220
Explain the motivation for making this change. What existing problem does the pull request solve?
Addition of new Endpoint(remove/{doc_id}/permanent) which will:
soft deletes the document — meaning its metadata and reference are retained in the database, but it is marked as deleted (deleted_at is set). The actual file stored in cloud storage (e.g., S3) is permanently deleted, and this action is irreversible.
If the document is part of an active collection, those collections
will be deleted using the collections delete interface. Noteably, this
means all OpenAI Vector Store's and Assistant's to which this document
belongs will be deleted.
Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.