feat(api,shared): métadonnées multi-providers et automatisation des scans/enrichissements
Chaîne de résolution metadata (local, Open Library, Google Books, BNF) avec activation/priorité/clé API par provider, colonnes isbn13 et identifiers sur les livres, et intégration au scanner pour compléter métadonnées et jaquettes manquantes. Module automation: réglages persistés, planifications scan/enrichissement et déclenchement manuel, exposés via des endpoints admin. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
20
apps/api/src/metadata/resolve-provider-chain.test.ts
Normal file
20
apps/api/src/metadata/resolve-provider-chain.test.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { MetadataProvider } from "./metadata.types.js";
|
||||
import { ResolveProviderChain } from "./use-cases/resolve-provider-chain.js";
|
||||
|
||||
const provider = (id: MetadataProvider["id"]): MetadataProvider => ({
|
||||
id,
|
||||
lookup: async () => null
|
||||
});
|
||||
|
||||
describe("ResolveProviderChain", () => {
|
||||
it("keeps local active and orders enabled remote providers by priority", () => {
|
||||
const chain = new ResolveProviderChain([provider("googlebooks"), provider("local"), provider("bnf")]).resolve([
|
||||
{ provider: "local", enabled: false, priority: 99, apiKey: null },
|
||||
{ provider: "googlebooks", enabled: true, priority: 2, apiKey: null },
|
||||
{ provider: "bnf", enabled: true, priority: 1, apiKey: null }
|
||||
]);
|
||||
|
||||
expect(chain.map((entry) => entry.provider.id)).toEqual(["bnf", "googlebooks", "local"]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user