feat(ebooks): add ISBN normalization and graceful library requirement handling

- Increase ISBN column from VARCHAR(13) to VARCHAR(17) to support ISBN-13 with hyphens
- Add normalize_isbn() database function to automatically remove hyphens and spaces
- Create trigger to auto-normalize ISBNs on INSERT/UPDATE operations
- Update all Ebook and MediaItem queries to use ISBN normalization
- Add GetEbookLibraryID query to check for existing ebook libraries
- Add graceful error handling when no ebook library exists
- Return helpful error message: 'no ebook library found. Please create an ebook library first'
- Create comprehensive tests for ISBN normalization and library selection
- Add Bruno test files for various ISBN formats and error scenarios
- Update documentation with ISBN normalization details
This commit is contained in:
2026-01-29 10:52:14 -05:00
parent 6ed69005b5
commit 66f1eb11a0
10 changed files with 709 additions and 24 deletions
+1
View File
@@ -52,6 +52,7 @@ type Querier interface {
GetEbookByFilePath(ctx context.Context, filePath string) (Ebooks, error)
GetEbookHighlight(ctx context.Context, id pgtype.UUID) (EbookHighlights, error)
GetEbookHighlights(ctx context.Context, arg GetEbookHighlightsParams) ([]EbookHighlights, error)
GetEbookLibraryID(ctx context.Context) (pgtype.UUID, error)
GetEbookNote(ctx context.Context, id pgtype.UUID) (EbookNotes, error)
GetEbookNotes(ctx context.Context, arg GetEbookNotesParams) ([]EbookNotes, error)
GetEbookRating(ctx context.Context, arg GetEbookRatingParams) (EbookRatings, error)