- 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
47 lines
969 B
Plaintext
47 lines
969 B
Plaintext
meta {
|
|
name: Create Ebook - No Library Error
|
|
type: http
|
|
seq: 11
|
|
}
|
|
|
|
post {
|
|
url: {{base_url}}/api/ebooks
|
|
body: json
|
|
auth: inherit
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"title": "Test Ebook",
|
|
"isbn": "9780123456789",
|
|
"description": "Testing error when no library exists",
|
|
"file_path": "/path/to/ebook.epub",
|
|
"file_size": 1048576,
|
|
"mime_type": "application/epub+zip"
|
|
}
|
|
}
|
|
|
|
settings {
|
|
encodeUrl: true
|
|
timeout: 0
|
|
}
|
|
|
|
docs {
|
|
## Create Ebook - No Library Error
|
|
|
|
**Expected Behavior:** Should return 400 Bad Request with error message: "no ebook library found. Please create an ebook library first"
|
|
|
|
This test demonstrates the graceful error handling when attempting to create an ebook without first creating an ebook library.
|
|
|
|
**Setup Required:**
|
|
- Ensure NO ebook library exists in the database
|
|
- Run as admin user
|
|
|
|
**Expected Response:**
|
|
```json
|
|
{
|
|
"error": "no ebook library found. Please create an ebook library first"
|
|
}
|
|
```
|
|
}
|