Fix/hardcover api key per user (#1943)

* feat: add hardcover API key and sync settings to KoboSync and KoboUserSettings entities

* feat(hardcover): enhance sync functionality to use per-user API keys

- Updated HardcoverSyncService to utilize user-specific Hardcover API keys for syncing reading progress.
- Modified syncProgressToHardcover method to accept userId, allowing for personalized sync settings.
- Improved logging to include userId in sync operations for better traceability.
- Adjusted KoboReadingStateService to pass userId when triggering sync to Hardcover.

* feat(database): update kobo_location_source column size and add hardcover settings

- Increased the size of the kobo_location_source column to accommodate longer location strings from Kobo devices.
- Added new columns for hardcover API key and sync settings in the kobo_user_settings table to enhance user customization.

* refactor(hardcover): update tests to use user-specific Kobo settings

- Replaced AppSettingService with KoboSettingsService in HardcoverSyncServiceTest to utilize user-specific settings.
- Modified syncProgressToHardcover method calls to include userId for personalized sync operations.
- Added a new test case to handle scenarios where user settings are not found, ensuring robust error handling.

---------

Co-authored-by: akiraslingshot <akiraslingshot@gmail.com>
This commit is contained in:
Giancarlo Perrone
2025-12-19 18:56:41 -07:00
committed by GitHub
co-authored by akiraslingshot
parent 54108754f9
commit 32a1a2ac34
11 changed files with 271 additions and 117 deletions
@@ -0,0 +1,6 @@
-- Add per-user Hardcover settings to kobo_user_settings table
ALTER TABLE kobo_user_settings ADD COLUMN hardcover_api_key VARCHAR(2048);
ALTER TABLE kobo_user_settings ADD COLUMN hardcover_sync_enabled BOOLEAN DEFAULT FALSE;
-- Fix kobo_location_source column size (Kobo devices can send longer location strings)
ALTER TABLE user_book_progress MODIFY COLUMN kobo_location_source VARCHAR(512);