feat: look up a book by its provider ID or link #100
No reviewers
Labels
No labels
bug
critical
ebook-branch
high
low
main
medium
release-blocker
security
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jfro/fuzzy_catalog!100
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/provider-id-lookup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a Provider ID tab to Add Book: paste a book's link or ID from Hardcover, Open Library or Google Books and get that exact book or edition back, shown with its cover and provider, ready to add.
Accepted:
OL…W(work) orOL…M(edition), or anopenlibrary.org/works/…//books/…link. Merged works (old IDs that now redirect) are followed.hardcover.app/books/<slug>(its most-read edition),…/editions/<id>, or a numeric book ID (312460orhardcover:312460).zyTCAlFPjgYC,google:…),books.google.com/books?id=…orgoogle.com/books/edition/_/<id>.How:
FuzzyCatalog.Catalog.ProviderId.parse/1works out provider, kind and ID. Anything that isn't well-formed is refused before any request, so nothing user-typed reaches a GraphQL query or URL path unchecked.lookup_by_id/2callback (Hardcover, Open Library, Google Books).BookLookup.lookup_by_provider_id/1logsID lookup: <provider> <kind> <id> -> <outcome> in <ms>ms; results carry:provider.:hardcover_req_options(for Req.Test stubs, like the other providers).Tests: parser cases (incl. injection-shaped input), stubbed Req for each provider and kind (redirects, 404s, Hardcover not configured), controller test for the tab, result and error.
mix precommit: 694 tests pass.Checked live: Open Library work (merged OL893415W → Dune) and edition (OL7353617M → Fantastic Mr. Fox, Roald Dahl). Google returned 429 (shared anonymous quota) and there's no Hardcover token here, so those are covered by stubs only; the Hardcover query fields (
book_id,users_count, bookslug) match Hardcover's schema docs.Stacked on #95 (feat/manual-lookup-providers); retarget to main once it merges.
Closes #97
Adds a Provider ID tab to Add Book. Paste a Hardcover book/edition link or book ID, an Open Library work (OL…W) or edition (OL…M) ID or link, or a Google Books volume ID or link, and get that exact book back, with its cover and provider, ready to add. - ProviderId parses IDs and links; anything that isn't a well-formed ID is refused before a request is made (keeps GraphQL and paths clean) - providers gain an optional lookup_by_id/2: Hardcover queries editions by id, book_id (most-read edition) or book slug; Open Library searches by work key (following merged-work redirects) or reads the edition record, filling authors from their records when the edition has no ISBN; Google Books fetches volumes/{id} - BookLookup.lookup_by_provider_id/1 logs provider, kind, id, outcome and duration - Hardcover requests take :hardcover_req_options so they can be stubbed Closes #97