feat: create and edit manual books #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/manual-books"
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?
Summary
Readers can now add a book by hand when Open Library has no usable match, and correct the details of books they added this way. This covers "Manual book creation/corrections" from
docs/EXPLORATION_IDEAS.md. It does not add an override layer for catalogue books; "Metadata corrections" stays in "Maybe later".Entry points
Decisions
library_bookrow whosework_idismanual:<uuid>. The uuid is the row's own id. Manual books are recognised by the prefix (isManualBook()), so there is no separate flag. These IDs never collide with Open Library keys, and the existing(user, work, language)uniqueness still holds. A DB check enforceswork_id like 'manual:%'⇔source_url is null. I didn't change the deduplication or identity of Open Library books.isbns text[] default '{}'column and makessource_urlnullable (only manual books have none). Thesubtitlecolumn is the one master added in #4.BookSearchResultgets optionalisbns, andsourceUrlbecomesstring | null.toBookSearchResultonly sendsisbnswhen set, so re-saving a catalogue book still passes the strict save payload.https://cover URL. Series, ratings and author IDs are left out.PUT /api/library/books/:id/metadataonly updates rows that belong to the user and have amanual:ID. Catalogue books return 404.PUTfor saved books.POST /api/library/imports/:id/items/:itemId/manualholds the import lease, inserts the manual book, then calls the existingfinishItem/mergeImportedBook. A repeat import reuses the manual book through the earlier confirmed Goodreads row, the same way it does for catalogue matches. Imports never change a manual book's details; they only merge status and shelves.docs/goodreads-import.mdis updated.Verification
pnpm lint-fullpasses on every commit.http://cover returns 400, and/api/recommendationsstill returns 200 with manual books saved.Demo
Download the demo video (50 s, sped up 1.8x): add a book manually with a reading status and language, edit its details, then create an unmatched Goodreads row manually from the import review.
Reviewed the seven commits on
feat/manual-booksfromgit merge-base origin/master HEAD, excluding the unrelated changes subsequently merged into master.pnpm lint-fullpasses.Important — fix before merge
[P2] Preserve commas inside author names when opening/saving the manual form.
shared/utils/manual-book.ts:44,58joins the author array with commas and then splits on every comma. For example, a valid Goodreads primary authorMartin Luther King, Jr.is preserved as one author byserver/utils/goodreads-csv.ts, but submitting the prefilled manual form changes it into two authors,Martin Luther KingandJr.. An author supplied through the manual API suffers the same corruption on a later unrelated edit through the UI. This changes author links and title/author recommendation matching, even though the displayed joined text looks unchanged. Use a representation that round-trips individual names, such as separate author inputs or one author per line.[P2] Keep the submitted publication year authoritative for manual books.
server/utils/library-import.ts:199-200inserts the submitted metadata and immediately passes it throughfinishItem/mergeImportedBook. The latter's fallback at line 59 replaces a deliberately submitted null year with the original CSV year. Reproduction: review a row with a publication year, choose Create manually, clear First published, and submit; the book still has the CSV year. Clearing it later through Edit details also gets undone when the same CSV is uploaded again and its confirmed manual identity is reused. Preserve explicit manual metadata while merging Goodreads shelves/status, including an intentionally unknown year.Pre-existing — optional follow-up
server/utils/recommendations.ts:34,38-39adds saved title/author hashes toexcluded, but tests onlyrow.workIdwhenever present. A manual book and a trending/award recommendation with identical title and authors therefore remain in the feed together: the savedmanual:<uuid>cannot equal the recommendation's Open Library ID, and its matching title/author hash is never checked. This filtering limitation predates the PR (it also affects distinct Open Library records for the same title/authors), but manual identities make it unavoidable for these sources. Consider checking the normalized title/author key as well as the work ID before grouping.Nit picks / security
No findings. The new routes require authentication and scope mutations to the owner; the normal save schema rejects manual IDs. Manual cover URLs require HTTPS and are rendered in a plain browser image, with no server-side fetch. I found no additional upstream requests introduced by these changes.
13fb7e0e4ftod10860d489Thanks for the review. I fixed all three findings.
fix: enter manual book authors one per line to keep commas in names). The form now uses a textarea with one author per line, so names likeMartin Luther King, Jr.survive both the Goodreads prefill and later edits. ISBNs stay comma separated because they never contain commas. I checked in the browser that creating and then editing a book keeps["Martin Luther King, Jr.", "Coretta Scott King"].fix(import): keep submitted metadata of manual books when merging shelves).mergeImportedBookno longer runs its "fill missing metadata" update when the saved row is amanual:book. Goodreads status and shelves are still merged. I checked both paths: "Create manually" with the year cleared storesnull, and re-uploading the same CSV row (year 2014) keepsnullwhile still adding the new shelf. The import guide now says imports never change a manual book's details.fix(recommendations): exclude saved books by title and authors even when a work ID exists). The feed now skips a row when its own title/author key matches a saved book, even if the row has an Open Library work ID. Dismissals behave as before.Rebase: onto master after #3, #4 and the author-pages PR.
library_bookhas a singlesubtitlecolumn, master's. I dropped mine.(user, work);manual:<uuid>rows simply never collide.0010_bright_prima:source_urlnullable, anisbnscolumn, and the manual/source check.pnpm lint-fullpasses, and a browser re-check of create and edit worked.