mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-07-15 01:01:11 +00:00
Add per-shelf autoRequest toggle
Introduce an autoRequest boolean on Goodreads and Hardcover shelves (default true) so users can pause/resume automatic request creation. Schema, API handlers, hooks and types were updated to accept and persist autoRequest when creating or updating shelves; add endpoints only trigger an immediate resync when the feed/token changes. The shelf sync core and service code now respect autoRequest (skipping request creation and annotating logs when disabled). UI updates include an AddShelf toggle, manage/update payload changes, shelf list props, and visual indicators + toggle actions in the shelf cards.
This commit is contained in:
@@ -17,6 +17,7 @@ const logger = RMABLogger.create('API.HardcoverShelves');
|
||||
const UpdateHardcoverSchema = z.object({
|
||||
listId: z.string().min(1, 'List ID is required').optional(),
|
||||
apiToken: z.string().optional(),
|
||||
autoRequest: z.boolean().optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -89,9 +90,13 @@ export async function PATCH(
|
||||
}
|
||||
|
||||
const body = await request.json();
|
||||
const { listId, apiToken } = UpdateHardcoverSchema.parse(body);
|
||||
const { listId, apiToken, autoRequest } = UpdateHardcoverSchema.parse(body);
|
||||
|
||||
const updateData: { listId?: string; apiToken?: string; lastSyncAt?: null; bookCount?: null; coverUrls?: null } = {};
|
||||
const updateData: { listId?: string; apiToken?: string; autoRequest?: boolean; lastSyncAt?: null; bookCount?: null; coverUrls?: null } = {};
|
||||
|
||||
if (autoRequest !== undefined) {
|
||||
updateData.autoRequest = autoRequest;
|
||||
}
|
||||
let needsResync = false;
|
||||
|
||||
let cleanedToken: string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user