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
@@ -0,0 +1,36 @@
meta {
name: Create Ebook with ISBN (with spaces)
type: http
seq: 10
}
post {
url: {{base_url}}/api/ebooks
body: json
auth: inherit
}
body:json {
{
"title": "Ebook with ISBN-13 (with spaces)",
"author": "Test Author",
"isbn": "978 0123456789",
"description": "Testing ISBN normalization with spaces",
"file_path": "/path/to/ebook2.epub",
"file_size": 1048576,
"mime_type": "application/epub+zip"
}
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Create Ebook with ISBN-13 (with spaces)
**Expected Behavior:** ISBN should be normalized to `9780123456789`
This test demonstrates that ISBNs with spaces are automatically normalized.
}