mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
Add authors pages and requestType notifications
Introduce full authors browsing/detail feature and enhance notifications to support type-specific titles. - Add server APIs: authors search, author detail, and author books routes (audnexus integration) that require auth and enrich results with library matches. - Add frontend pages/components: /authors listing and /authors/[asin] detail pages; AuthorCard, AuthorGrid, AuthorDetailCard, SimilarAuthorsRow, and related skeletons. - Add hook and integration stubs: new useAuthors hook and audnexus-authors integration; update audible service to expose audibleBaseUrl. - Update AudiobookDetailsModal to use audibleBaseUrl and link author names to author detail pages. - Add header navigation link to Authors. - Notifications: extend docs and code to include requestType (audiobook|ebook), add getEventTitle/getEventMeta helpers, update queue signature and providers/processors/tests to pass/handle requestType so titles can be resolved per request type. - Misc: job queue, processors, provider tests and notification tests updated to reflect new behavior. This change enables browsing authors and provides type-aware notification titles without per-provider changes.
This commit is contained in:
@@ -33,10 +33,16 @@ model NotificationBackend {
|
||||
|-------|---------|------------------------|
|
||||
| request_pending_approval | User creates request | Request needs admin approval |
|
||||
| request_approved | Admin approves OR auto-approval | Request approved (manual or auto) |
|
||||
| request_available | Plex/ABS scan completes | Audiobook available in library |
|
||||
| request_available | Plex/ABS scan or ebook download completes | Request available (title resolves by type) |
|
||||
| request_error | Download/import fails | Request failed at any stage |
|
||||
| issue_reported | User reports issue | User reports problem with available audiobook |
|
||||
|
||||
**Dynamic Titles:** Events can define `titleByRequestType` in `notification-events.ts` for type-specific titles.
|
||||
- `request_available` + `requestType: 'audiobook'` → "Audiobook Available"
|
||||
- `request_available` + `requestType: 'ebook'` → "Ebook Available"
|
||||
- `request_available` + no requestType → "Request Available" (fallback)
|
||||
- Use `getEventTitle(event, requestType?)` to resolve titles in providers
|
||||
|
||||
## Notification Triggers
|
||||
|
||||
**Request Creation (POST /api/requests)**
|
||||
@@ -60,10 +66,14 @@ model NotificationBackend {
|
||||
- Approve (with or without pre-selected torrent): After job triggered → request_approved
|
||||
- Deny: No notification
|
||||
|
||||
**Request Available (processors: scan-plex, plex-recently-added)**
|
||||
- After `status: 'available'` update → request_available
|
||||
**Audiobook Available (processors: scan-plex, plex-recently-added)**
|
||||
- After `status: 'available'` update → request_available (requestType: 'audiobook')
|
||||
- Includes user info in query (plexUsername)
|
||||
|
||||
**Ebook Available (processor: organize-files)**
|
||||
- After ebook `status: 'downloaded'` (terminal) → request_available (requestType: 'ebook')
|
||||
- Ebooks don't transition to 'available' via Plex matching
|
||||
|
||||
**Request Error (processors: monitor-download, organize-files)**
|
||||
- After `status: 'failed'` or `status: 'warn'` update → request_error
|
||||
- Includes error message in payload
|
||||
@@ -166,6 +176,7 @@ model NotificationBackend {
|
||||
author: string,
|
||||
userName: string,
|
||||
message?: string,
|
||||
requestType?: string, // 'audiobook' | 'ebook' — drives type-specific titles
|
||||
timestamp: Date
|
||||
}
|
||||
```
|
||||
@@ -174,7 +185,7 @@ model NotificationBackend {
|
||||
- Calls NotificationService.sendNotification()
|
||||
- Non-blocking error handling (logs but doesn't throw)
|
||||
|
||||
**Queue Method:** `addNotificationJob(event, requestId, title, author, userName, message?)`
|
||||
**Queue Method:** `addNotificationJob(event, requestId, title, author, userName, message?, requestType?)`
|
||||
|
||||
## Architecture
|
||||
|
||||
@@ -203,10 +214,15 @@ src/lib/services/notification/
|
||||
**ProviderMetadata:** `{ type, displayName, description, iconLabel, iconColor, configFields[] }`
|
||||
**ProviderConfigField:** `{ name, label, type, required, placeholder?, defaultValue?, options? }`
|
||||
|
||||
**Helper functions:**
|
||||
**Helper functions (notification.service.ts):**
|
||||
- `getRegisteredProviderTypes(): string[]` — all registered type keys
|
||||
- `getAllProviderMetadata(): ProviderMetadata[]` — metadata for all providers
|
||||
|
||||
**Helper functions (notification-events.ts):**
|
||||
- `getEventMeta(event)` — raw event metadata (label, title, emoji, severity, priority)
|
||||
- `getEventTitle(event, requestType?)` — resolved title (checks `titleByRequestType` first, falls back to `title`)
|
||||
- `getEventLabel(event)` — human-readable label for UI
|
||||
|
||||
**API Endpoint:** `GET /api/admin/notifications/providers` — returns all provider metadata (admin-only)
|
||||
|
||||
## Extensibility
|
||||
@@ -221,10 +237,10 @@ src/lib/services/notification/
|
||||
No UI changes, no API route changes, no Zod schema changes needed — the UI renders dynamically from provider metadata.
|
||||
|
||||
**Adding New Event (e.g., download_complete):**
|
||||
1. Add 'download_complete' to NotificationEvent enum
|
||||
2. Add to event labels in UI
|
||||
3. Add trigger point in processor
|
||||
4. Add message formatting in Discord/Pushover formatters
|
||||
1. Add entry to `NOTIFICATION_EVENTS` in `notification-events.ts` (label, title, emoji, severity, priority)
|
||||
2. Optionally add `titleByRequestType` for type-specific titles
|
||||
3. Add trigger point in processor, passing `requestType` if relevant
|
||||
4. Providers auto-resolve titles via `getEventTitle()` — no per-provider changes needed
|
||||
|
||||
## Tech Stack
|
||||
- Bull (job queue)
|
||||
|
||||
Reference in New Issue
Block a user