Conversation
Looks good to me!
- Rename routers/books.py → routers/books/api.py and add __init__.py - Move ISBN lookup helpers (goob_meta, open_lib_meta, open_wiki_meta) into a new service.py, renamed to snake_case - Add lookup_book_metadata_by_isbn() to orchestrate multi-source fallback - Extract book_create_from_form / book_update_from_form helpers into service - Add search serialization helpers (search_books_json etc.) to service - Slim api.py down to routing/HTTP concerns only
- Wrap Google Books and Open Library ISBN lookups in BookMetadataClient class with typed methods and named API base URL constants - Add responses==0.25.8 to requirements for HTTP mocking in tests - Add tests/routers/books/test_service.py with 190-line test suite covering ISBN lookup, form helpers, and search serialization
- Extract BookMetadataClient into ubiblio/routers/books/book_metadata_client.py - Move open_wiki_meta and goob_title into the class as open_wiki_by_isbn (also migrates Wikipedia to use OPEN_WIKI_API constant and USER_AGENT)
Fixes a bug around admin user restrictions for add_book endpoint
Refactor: replace manual auth checks with annotated dependency injection (as per fast api docos)
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 fixes #54 and #59.
Also a major refactor to auth handling, bringing it line with fastAPI best practices. The old method required manual handling of auth logic inside each endpoint.