Skip to content

Refactor auth, some optimization to fetching by ISBN - #68

Merged
seanboyce merged 22 commits into
releasefrom
dev
Apr 27, 2026
Merged

Refactor auth, some optimization to fetching by ISBN#68
seanboyce merged 22 commits into
releasefrom
dev

Conversation

@seanboyce

@seanboyce seanboyce commented Apr 27, 2026

Copy link
Copy Markdown
Owner

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.

singhgarima and others added 22 commits April 19, 2026 19:24
- 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)
Two Major Changes:
* Allow adding using Scan or by ISBN for books without Author #59
* ISBN auto-add feature makes two calls to openLibrary, only one is
  necessary #54
 (Issue #59 and Issue #54) Allow scanning a book without Author
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)
@seanboyce
seanboyce merged commit ffbe83d into release Apr 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants