[FIX] DocumentAPI to query by params and return multiple documents & fix PDF file fetching#123
Merged
Merged
Conversation
- Updated type hints in `files.py` for better clarity and consistency. - Enhanced error handling in `put_file` and `list_objects` functions. - Improved metadata handling in `ObjectMetadata` and `ListObjectsResponse` classes. - Cleaned up optional parameters and added type ignores where necessary for compatibility.
- Updated the `get` method to accept a dictionary of parameters for searching documents by workspace ID, ID, PMID, DOI, or reference. - Enhanced error handling for cases with no documents found or multiple documents returned. - Refactored related document model and repository methods to align with the new API structure. - Updated frontend components to utilize the new document fetching logic, ensuring compatibility with the revised API.
|
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 9 files with indirect coverage changes
🚀 New features to boost your workflow:
|
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.
This pull request introduces significant improvements to the document retrieval system across both the frontend and backend, unifying and simplifying how documents are fetched by various identifiers (ID, PMID, DOI, reference) and workspace. It removes legacy endpoints and methods, centralizes document fetching logic, and updates the data models and API contracts accordingly. The changes also include type and signature improvements for better type safety and maintainability.
Backend API and Logic Unification:
/documents/by-id/{id}and/documents/by-pmid/{pmid}endpoints with a single/documentsendpoint that acceptsworkspace_idand one or more identifiers (id,pmid,doi,reference), returning a list of matching documents and providing better error handling for missing or ambiguous queries.Frontend Document Fetching Refactor:
fetchDocumentmethod that queries documents by any identifier and workspace, replacing the previousfetchDocumentByIDandfetchDocumentByPubmedIDmethods. The view model and use case now expect and handle the new API response format. [1] [2] [3] [4]Repository and Domain Model Updates:
getDocumentByIdandgetDocumentByPubmedIDto a singlegetDocumentsmethod that matches the new backend API, returning an array of documents. Updated the domain model to includedoias a possible identifier. [1] [2]Type and Signature Improvements:
lang="ts"), API handler signatures, and Minio/file handling code to improve code safety and clarity. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]Minor Fixes and Cleanups:
These changes together make document retrieval more robust, flexible, and maintainable across the application.