Adds a new job type that refreshes metadata from external providers for all series already linked via approved external_metadata_links. Tracks and displays per-field diffs (series and book level), respects locked fields, and provides a detailed change report in the job detail page. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
562 B
TypeScript
17 lines
562 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { apiFetch } from "@/lib/api";
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const body = await request.json();
|
|
const data = await apiFetch<{ id: string; status: string }>("/metadata/refresh", {
|
|
method: "POST",
|
|
body: JSON.stringify(body),
|
|
});
|
|
return NextResponse.json(data);
|
|
} catch (error) {
|
|
const message = error instanceof Error ? error.message : "Failed to start refresh";
|
|
return NextResponse.json({ error: message }, { status: 500 });
|
|
}
|
|
}
|