feat: merge books from the duplicates screen and the toolbar

A workbench with the folded records in a rail, the survivor's fields live and
editable beside them, and per-field actions chosen by what kind of field it is.
Fields the records agree on stay out of the way. Reachable from a duplicate
group and from the selection toolbar, which is the only way to merge a pair the
detector never proposed.
This commit is contained in:
2026-08-16 20:21:19 -04:00
parent 22539644a9
commit 699a1a7fa2
8 changed files with 781 additions and 32 deletions
+19
View File
@@ -9,6 +9,7 @@ import {
editBookMetadataSchema,
updateBookProgressSchema,
duplicateDismissalSchema,
bookMergeSchema,
type Book,
type BooksUploadResult,
type DuplicateBookGroup,
@@ -174,6 +175,24 @@ export const listDuplicateBooks = query(
}
);
/**
* Fold several books into one and delete the records folded in.
*
* Irreversible, so the caller is expected to have shown what is about to happen.
*/
export const mergeBooks = command(
bookMergeSchema,
async ({ library_id, ...data }): Promise<Book> => {
const { locals } = getRequestEvent();
const response = await locals.api.post(`/books/merge?library_id=${library_id}`, data);
if (!response.ok) error(response.status, detailOf(await response.text()));
return await response.json();
}
);
/** Record that two books are not the same book, so the pair stops being proposed. */
export const dismissDuplicateBooks = command(duplicateDismissalSchema, async (data) => {
const { locals } = getRequestEvent();