feat(hardcover): sync Kobo reading progress to Hardcover (#1926)

* feat(hardcover): sync Kobo reading progress to Hardcover

- Add HardcoverSyncService to sync reading progress asynchronously
- Store hardcover_book_id in book_metadata for faster lookups
- Integrate with KoboReadingStateService to trigger sync on progress updates
- Add database migration for hardcover_book_id column

* test(hardcover): add unit tests for HardcoverSyncService

* test(hardcover): add HardcoverSyncService mock to unit tests for improved coverage

* refactor(hardcover): update syncProgressToHardcover method to use book ID

- Changed syncProgressToHardcover to accept book ID instead of BookEntity.
- Integrated BookRepository to fetch BookEntity within the method.
- Updated related unit tests to reflect the new method signature and ensure proper functionality.

* feat(hardcover): enhance HardcoverSyncService with edition lookup and logging

- Added a method to find an edition by ISBN, improving the accuracy of edition information.
- Enhanced logging for progress calculations, search responses, and reading progress updates for better traceability.
- Updated the handling of default edition IDs to ensure correct page counts are used when available.

* feat(metadata): add hardcoverBookId and its locking mechanism

- Introduced hardcoverBookId and hardcoverBookIdLocked fields to MetadataClearFlags, BookMetadata, and BookMetadataEntity.
- Updated BookMetadataUpdater to handle locking for hardcoverBookId.
- Enhanced MetadataChangeDetector to compare changes for hardcoverBookId, ensuring proper metadata management.

* feat(metadata): add hardcoverBookId input and display in metadata dialogs

- Introduced hardcoverBookId input field in the metadata editor with locking mechanism.
- Updated metadata restore dialog to display hardcoverBookId when available.
- Enhanced user interface for better metadata management and visibility.

* feat(metadata): integrate hardcoverBookId across components and forms

- Added hardcoverBookId and hardcoverBookIdLocked fields to relevant models and interfaces.
- Updated metadata editor, picker, and review components to include hardcoverBookId input and locking functionality.
- Enhanced form controls and metadata handling to support the new hardcoverBookId feature for improved user experience.

* feat(migration): add hardcover_book_id_locked column to book_metadata table

- Introduced a new column hardcover_book_id_locked with a default value of FALSE to the book_metadata table for enhanced metadata management.

* fix(metadata): realign html with develop

---------

Co-authored-by: akiraslingshot <akiraslingshot@gmail.com>
This commit is contained in:
Giancarlo Perrone
2025-12-19 10:56:40 -07:00
committed by GitHub
co-authored by akiraslingshot
parent f869ac0ac4
commit 2da01e7a2e
22 changed files with 1124 additions and 2 deletions
@@ -75,6 +75,7 @@ export class BookdropFileMetadataPickerComponent {
{label: 'Goodreads #', controlName: 'goodreadsReviewCount', lockedKey: 'goodreadsReviewCountLocked', fetchedKey: 'goodreadsReviewCount'},
{label: 'Goodreads ★', controlName: 'goodreadsRating', lockedKey: 'goodreadsRatingLocked', fetchedKey: 'goodreadsRating'},
{label: 'Hardcover ID', controlName: 'hardcoverId', lockedKey: 'hardcoverIdLocked', fetchedKey: 'hardcoverId'},
{label: 'Hardcover Book ID', controlName: 'hardcoverBookId', lockedKey: 'hardcoverBookIdLocked', fetchedKey: 'hardcoverBookId'},
{label: 'Hardcover #', controlName: 'hardcoverReviewCount', lockedKey: 'hardcoverReviewCountLocked', fetchedKey: 'hardcoverReviewCount'},
{label: 'Hardcover ★', controlName: 'hardcoverRating', lockedKey: 'hardcoverRatingLocked', fetchedKey: 'hardcoverRating'},
{label: 'Google ID', controlName: 'googleId', lockedKey: 'googleIdLocked', fetchedKey: 'googleId'},
@@ -203,6 +204,7 @@ export class BookdropFileMetadataPickerComponent {
goodreadsRating: this.originalMetadata.goodreadsRating || null,
goodreadsReviewCount: this.originalMetadata.goodreadsReviewCount || null,
hardcoverId: this.originalMetadata.hardcoverId || null,
hardcoverBookId: this.originalMetadata.hardcoverBookId || null,
hardcoverRating: this.originalMetadata.hardcoverRating || null,
hardcoverReviewCount: this.originalMetadata.hardcoverReviewCount || null,
googleId: this.originalMetadata.googleId || null,
@@ -319,6 +319,7 @@ export class BookdropFileReviewComponent implements OnInit {
goodreadsRating: original?.goodreadsRating ?? null,
goodreadsReviewCount: original?.goodreadsReviewCount ?? null,
hardcoverId: original?.hardcoverId ?? null,
hardcoverBookId: original?.hardcoverBookId ?? null,
hardcoverRating: original?.hardcoverRating ?? null,
hardcoverReviewCount: original?.hardcoverReviewCount ?? null,
googleId: original?.googleId ?? null,
@@ -567,6 +568,7 @@ export class BookdropFileReviewComponent implements OnInit {
goodreadsRating: new FormControl(original?.goodreadsRating ?? ''),
goodreadsReviewCount: new FormControl(original?.goodreadsReviewCount ?? ''),
hardcoverId: new FormControl(original?.hardcoverId ?? ''),
hardcoverBookId: new FormControl(original?.hardcoverBookId ?? ''),
hardcoverRating: new FormControl(original?.hardcoverRating ?? ''),
hardcoverReviewCount: new FormControl(original?.hardcoverReviewCount ?? ''),
googleId: new FormControl(original?.googleId ?? ''),