mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 12:50:09 +00:00
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:
@@ -52,8 +52,8 @@ export async function POST(
|
||||
);
|
||||
}
|
||||
|
||||
// Only allow manual search for pending, failed, awaiting_search statuses
|
||||
const searchableStatuses = ['pending', 'failed', 'awaiting_search'];
|
||||
// Only allow manual search for pending, failed, awaiting_search, awaiting_release statuses
|
||||
const searchableStatuses = ['pending', 'failed', 'awaiting_search', 'awaiting_release'];
|
||||
if (!searchableStatuses.includes(requestRecord.status)) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
|
||||
@@ -182,7 +182,7 @@ export async function PATCH(
|
||||
} else if (action === 'retry') {
|
||||
// Retry failed request - allow users to retry their own warn/failed requests
|
||||
// Only allow retry for failed, warn, or awaiting_* statuses
|
||||
const retryableStatuses = ['failed', 'warn', 'awaiting_search', 'awaiting_import'];
|
||||
const retryableStatuses = ['failed', 'warn', 'awaiting_search', 'awaiting_import', 'awaiting_release'];
|
||||
|
||||
if (!retryableStatuses.includes(requestRecord.status)) {
|
||||
return NextResponse.json(
|
||||
|
||||
@@ -101,7 +101,7 @@ export async function POST(request: NextRequest) {
|
||||
// Status groups for server-side filtering and count aggregation
|
||||
const STATUS_GROUPS: Record<string, string[]> = {
|
||||
active: ['pending', 'searching', 'downloading', 'processing'],
|
||||
waiting: ['awaiting_search', 'awaiting_import', 'awaiting_approval'],
|
||||
waiting: ['awaiting_search', 'awaiting_import', 'awaiting_approval', 'awaiting_release'],
|
||||
completed: ['available', 'downloaded'],
|
||||
failed: ['failed'],
|
||||
cancelled: ['cancelled', 'denied'],
|
||||
|
||||
Reference in New Issue
Block a user