fix: pass metadata_refresh_mode through backoffice proxy to API
The Next.js monitoring route was dropping metadata_refresh_mode from the request body, so the value was never forwarded to the Rust API and reverted on reload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,8 @@ export async function PATCH(
|
||||
) {
|
||||
const { id } = await params;
|
||||
try {
|
||||
const { monitor_enabled, scan_mode, watcher_enabled } = await request.json();
|
||||
const data = await updateLibraryMonitoring(id, monitor_enabled, scan_mode, watcher_enabled);
|
||||
const { monitor_enabled, scan_mode, watcher_enabled, metadata_refresh_mode } = await request.json();
|
||||
const data = await updateLibraryMonitoring(id, monitor_enabled, scan_mode, watcher_enabled, metadata_refresh_mode);
|
||||
return NextResponse.json(data);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : "Failed to update monitoring settings";
|
||||
|
||||
@@ -10,6 +10,8 @@ export type LibraryDto = {
|
||||
watcher_enabled: boolean;
|
||||
metadata_provider: string | null;
|
||||
fallback_metadata_provider: string | null;
|
||||
metadata_refresh_mode: string;
|
||||
next_metadata_refresh_at: string | null;
|
||||
};
|
||||
|
||||
export type IndexJobDto = {
|
||||
@@ -192,11 +194,13 @@ export async function updateLibraryMonitoring(
|
||||
monitorEnabled: boolean,
|
||||
scanMode: string,
|
||||
watcherEnabled?: boolean,
|
||||
metadataRefreshMode?: string,
|
||||
) {
|
||||
const body: {
|
||||
monitor_enabled: boolean;
|
||||
scan_mode: string;
|
||||
watcher_enabled?: boolean;
|
||||
metadata_refresh_mode?: string;
|
||||
} = {
|
||||
monitor_enabled: monitorEnabled,
|
||||
scan_mode: scanMode,
|
||||
@@ -204,6 +208,9 @@ export async function updateLibraryMonitoring(
|
||||
if (watcherEnabled !== undefined) {
|
||||
body.watcher_enabled = watcherEnabled;
|
||||
}
|
||||
if (metadataRefreshMode !== undefined) {
|
||||
body.metadata_refresh_mode = metadataRefreshMode;
|
||||
}
|
||||
return apiFetch<LibraryDto>(`/libraries/${libraryId}/monitoring`, {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(body),
|
||||
|
||||
Reference in New Issue
Block a user