Add skip-unreleased auto-search feature

Introduce an indexer-wide option to skip automatic searches for books with future release dates (config key: `indexer.skip_unreleased`, default ON). Adds a GET/PUT admin API for indexer options, a UI toggle on the Indexers settings tab (persisted on save), and persistence of a request-level releaseDate in the Prisma schema.

Adds a new request status `awaiting_release` and wires it through constants, UI components (StatusBadge, RequestCard, RecentRequestsTable, Audiobook card/modal, RequestActions), API request flows (bookdate swipe, request creation, manual search, request PATCHs, request listing groups), and services. Implements a pure release-date utility (isUnreleased / shouldSkipAutoSearch) and updates background processors: monitor-rss-feeds (skip matches but do not mutate status), retry-missing-torrents (drives bidirectional transitions between awaiting_search and awaiting_release and queues searches when appropriate), and request-creator/bookdate swipe (gate initial auto-search). Adds tests for the swipe gate and other related test updates. Logs transitions and gate decisions for observability.
This commit is contained in:
kikootwo
2026-05-15 15:35:01 -04:00
parent 5f62ba7146
commit 6f8ac86a43
37 changed files with 1289 additions and 77 deletions
+30
View File
@@ -130,6 +130,25 @@ src/app/admin/settings/
}
```
## Auto-Search Behavior (Indexers tab)
**Purpose:** Control how ReadMeABook performs automatic indexer searches. Lives on the Indexers tab between the Prowlarr connection block and the IndexerManagement list.
**Toggle:** Skip unreleased books in automatic searches
- When ON: auto-search skips books whose release date is in the future. Those requests automatically start searching once the book is released. Manual searches are unaffected.
- When OFF: auto-search proceeds regardless of release date.
**Configuration Key:**
| Key | Default | Category | Description |
|-----|---------|----------|-------------|
| `indexer.skip_unreleased` | `true` (ON) | `indexer` | Skip auto-searches for books with future release dates |
**Read contract (consumed by background workers):**
- `value !== 'false'` → ON (skip enabled). Missing key OR any non-`'false'` value → ON.
- Only the exact string `'false'` disables the toggle. Workers MUST match this.
**API:** Persisted via `PUT /api/admin/settings/indexer-options`. Saved alongside Prowlarr connection + indexer config when the Indexers tab Save button is clicked.
## Audible Region
**Purpose:** Configure which Audible region to use for metadata and search to ensure accurate ASIN matching with your metadata engine.
@@ -279,6 +298,17 @@ src/app/admin/settings/
- No test required if URL/API key unchanged
- Saves only enabled indexers to database
**GET /api/admin/settings/indexer-options**
- Returns `{ skipUnreleased: boolean }`
- Default ON: missing or non-`'false'` value resolves to `true`
- Admin auth required
**PUT /api/admin/settings/indexer-options**
- Updates indexer-wide auto-search options
- Body: `{ skipUnreleased: boolean }` (strict boolean validation)
- Persists `indexer.skip_unreleased` (category: `indexer`)
- No connection test required
**PUT /api/admin/settings/download-client**
- Updates download client config
- Requires prior successful test if credentials changed