docs: update comprehensive API documentation and project guides
This commit updates all documentation files throughout the project: - Updated IMPLEMENTATION_PLAN.md with new implementation details - Updated PROJECT_GUIDELINES.md with coding standards and practices - Updated README.md with current project information - Updated SCREENSHOT_AUTOMATION.md with new automation details - Added TEST_DATA.md with test fixtures data - Updated cover_image_serving_plan.md with static URL patterns Documentation API updates: - Updated API reference documentation for all endpoints including: - Authentication (login, logout, register, refresh_token) - Book matching (auto_link, bulk_link, link_book, search) - Collections (CRUD operations, shelf mappings, auto-assign rules) - Conflicts (bulk operations, resolve/dismiss) - Devices (registration, approval, shelf management) - Highlights (create, update, delete, get) - Kobo sync (bookmark, markup, initialization, sync) - KOReader sync (library, metadata, bookmarks, progress) - Libraries (CRUD, folders, media items, stats) - Media items (bulk operations, CRUD) - Notes (CRUD operations) - OPDS (acquisition, feeds, publication) - Progress (reading progress tracking) - Queue (device queue management) - Ratings (star ratings) - Scanner (watch mode, scan operations) - Sync protocols (Kobo, KOReader) - Users (profile, password, admin operations) - WebSocket protocols - Updated user guides (admin, dashboard, settings, sync) - Updated device setup guides (Kobo, KOReader) - Updated developer guides (testing, contributing, operations) - Updated scripts/README.md
This commit is contained in:
@@ -6,14 +6,15 @@ The backend implements dual-field normalization for searchability:
|
||||
|
||||
### Architecture
|
||||
|
||||
| Field Type | Purpose | Behavior | Example |
|
||||
|-----------|---------|-----------|----------|
|
||||
| **Display Field** (`tags`, `contributors`) | Show to users | Preserves exact variant, punctuation, proper casing | `"ACME CORP."` |
|
||||
| **Search Field** (`tags_search`, `contributors_search`) | Search against | Lowercase, no punctuation, deduplicated | `["acme corp"]` |
|
||||
| Field Type | Purpose | Behavior | Example |
|
||||
| ------------------------------------------------------- | -------------- | --------------------------------------------------- | --------------- |
|
||||
| **Display Field** (`tags`, `contributors`) | Show to users | Preserves exact variant, punctuation, proper casing | `"ACME CORP."` |
|
||||
| **Search Field** (`tags_search`, `contributors_search`) | Search against | Lowercase, no punctuation, deduplicated | `["acme corp"]` |
|
||||
|
||||
### Normalization Rules
|
||||
|
||||
#### Tags
|
||||
|
||||
1. Trim whitespace from each tag
|
||||
2. Titlecase each tag (preserves hyphenation: "non-fiction" → "Non-Fiction")
|
||||
3. Case-insensitive deduplication
|
||||
@@ -21,6 +22,7 @@ The backend implements dual-field normalization for searchability:
|
||||
5. Store both display and search versions
|
||||
|
||||
#### Contributors
|
||||
|
||||
1. Trim whitespace from each contributor
|
||||
2. Preserve original casing (including CAPSLOCK companies)
|
||||
3. Preserve original punctuation for display
|
||||
@@ -31,6 +33,7 @@ The backend implements dual-field normalization for searchability:
|
||||
### API Request/Response
|
||||
|
||||
**Request:**
|
||||
|
||||
```json
|
||||
{
|
||||
"tags": ["science-fiction", "ACME CORP.", " O'Reilly Media"],
|
||||
@@ -39,6 +42,7 @@ The backend implements dual-field normalization for searchability:
|
||||
```
|
||||
|
||||
**Response (after normalization):**
|
||||
|
||||
```json
|
||||
{
|
||||
"tags": ["Science-Fiction", "O'Reilly Media"],
|
||||
@@ -51,11 +55,13 @@ The backend implements dual-field normalization for searchability:
|
||||
### Frontend Implementation Guidelines
|
||||
|
||||
#### Display
|
||||
|
||||
- Use `tags` and `contributors` fields
|
||||
- These preserve exact user input (casing, punctuation)
|
||||
- No transformation needed
|
||||
|
||||
#### Search
|
||||
|
||||
- Use search inputs against `tags_search` and `contributors_search`
|
||||
- Normalize user search input:
|
||||
- Convert to lowercase
|
||||
@@ -63,6 +69,7 @@ The backend implements dual-field normalization for searchability:
|
||||
- Search using `= ANY()` operator
|
||||
|
||||
#### User Typing "Science-Fiction"
|
||||
|
||||
```typescript
|
||||
// User types exact value
|
||||
const searchValue = "Science-Fiction";
|
||||
@@ -73,6 +80,7 @@ const searchValue = "Science-Fiction";
|
||||
```
|
||||
|
||||
#### Search Query Behavior
|
||||
|
||||
```typescript
|
||||
// User searches: "ACME CORP."
|
||||
// Backend normalizes search to: "acme corp"
|
||||
@@ -85,6 +93,7 @@ const searchValue = "Science-Fiction";
|
||||
When building frontend checkbox filters for contributors/tags:
|
||||
|
||||
#### Get Unique Values for Dropdown
|
||||
|
||||
```typescript
|
||||
// Fetch distinct normalized values for filters
|
||||
GET /api/contributors?distinct=true
|
||||
@@ -94,6 +103,7 @@ Response: ["acme corp", "oreilly media", "penguin"]
|
||||
```
|
||||
|
||||
#### Filter Query
|
||||
|
||||
```typescript
|
||||
// User selects checkbox
|
||||
const filterValue = "acme corp";
|
||||
@@ -117,24 +127,28 @@ const filterValue = "acme corp";
|
||||
### Common Mistakes to Avoid
|
||||
|
||||
❌ **Searching display field directly**
|
||||
|
||||
```typescript
|
||||
// WRONG - Will miss different casing/punctuation
|
||||
WHERE 'ACME CORP.' = ANY(contributors)
|
||||
```
|
||||
|
||||
✅ **Search search field**
|
||||
|
||||
```typescript
|
||||
// CORRECT - Case-insensitive, punctuation-free
|
||||
WHERE 'acme corp' = ANY(contributors_search)
|
||||
```
|
||||
|
||||
❌ **Don't normalize user search input**
|
||||
|
||||
```typescript
|
||||
// WRONG - If user types "ACME CORP" explicitly to find exact match
|
||||
const search = "acme corp"; // Changes user's intent
|
||||
```
|
||||
|
||||
✅ **Use exact user input for search**
|
||||
|
||||
```typescript
|
||||
// CORRECT - Backend handles normalization
|
||||
const search = "ACME CORP"; // Backend will match "acme corp" in search field
|
||||
@@ -143,14 +157,17 @@ const search = "ACME CORP"; // Backend will match "acme corp" in search field
|
||||
### Schema Reference
|
||||
|
||||
**Display Fields:**
|
||||
|
||||
- `tags TEXT[]` - Titlecase, original punctuation
|
||||
- `contributors TEXT[]` - Original casing, original punctuation
|
||||
|
||||
**Search Fields:**
|
||||
|
||||
- `tags_search TEXT[]` - Lowercase, no punctuation, deduplicated
|
||||
- `contributors_search TEXT[]` - Lowercase, no punctuation, deduplicated
|
||||
|
||||
**GIN Indexes:**
|
||||
|
||||
- `idx_media_items_tags_search` - Fast search on tags_search
|
||||
- `idx_media_items_contributors_search` - Fast search on contributors_search
|
||||
- `idx_media_items_tags_gin` - Display field (if needed)
|
||||
|
||||
Reference in New Issue
Block a user