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:
@ -1,9 +1,13 @@
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, UseGuards } from "@nestjs/common";
|
||||
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, UseGuards } from "@nestjs/common";
|
||||
import {
|
||||
CreateLibraryDto,
|
||||
CreateLibrarySchema,
|
||||
CreateUserDto,
|
||||
CreateUserSchema,
|
||||
UpdateAutomationSettingsDto,
|
||||
UpdateAutomationSettingsSchema,
|
||||
UpdateMetadataSourcesConfigDto,
|
||||
UpdateMetadataSourcesConfigSchema,
|
||||
UpdateLibraryDto,
|
||||
UpdateLibrarySchema,
|
||||
UpdateUserDto,
|
||||
@ -13,9 +17,11 @@ import { AuthGuard } from "../auth/auth.guard.js";
|
||||
import { Roles } from "../auth/roles.decorator.js";
|
||||
import { RolesGuard } from "../auth/roles.guard.js";
|
||||
import { AuthService } from "../auth/auth.service.js";
|
||||
import { AutomationService } from "../automation/automation.service.js";
|
||||
import { ZodValidationPipe } from "../common/zod-validation.pipe.js";
|
||||
import { JobsService } from "../jobs/jobs.service.js";
|
||||
import { LibrariesService } from "../libraries/libraries.service.js";
|
||||
import { MetadataService } from "../metadata/metadata.service.js";
|
||||
import { ScannerService } from "../scanner/scanner.service.js";
|
||||
|
||||
@Controller("admin")
|
||||
@ -26,7 +32,9 @@ export class AdminController {
|
||||
private readonly auth: AuthService,
|
||||
private readonly libraries: LibrariesService,
|
||||
private readonly jobs: JobsService,
|
||||
private readonly scanner: ScannerService
|
||||
private readonly scanner: ScannerService,
|
||||
private readonly metadata: MetadataService,
|
||||
private readonly automation: AutomationService
|
||||
) {}
|
||||
|
||||
@Get("users")
|
||||
@ -80,4 +88,34 @@ export class AdminController {
|
||||
listJobs() {
|
||||
return this.jobs.list();
|
||||
}
|
||||
|
||||
@Get("metadata-sources")
|
||||
metadataSources() {
|
||||
return this.metadata.getSourcesConfig();
|
||||
}
|
||||
|
||||
@Put("metadata-sources")
|
||||
updateMetadataSources(@Body(new ZodValidationPipe(UpdateMetadataSourcesConfigSchema)) body: UpdateMetadataSourcesConfigDto) {
|
||||
return this.metadata.updateSourcesConfig(body);
|
||||
}
|
||||
|
||||
@Get("automation")
|
||||
automationSettings() {
|
||||
return this.automation.getSettings();
|
||||
}
|
||||
|
||||
@Put("automation")
|
||||
updateAutomationSettings(@Body(new ZodValidationPipe(UpdateAutomationSettingsSchema)) body: UpdateAutomationSettingsDto) {
|
||||
return this.automation.updateSettings(body);
|
||||
}
|
||||
|
||||
@Post("automation/run-scan")
|
||||
runAutomationScan() {
|
||||
return this.automation.runScanNow();
|
||||
}
|
||||
|
||||
@Post("automation/run-enrich")
|
||||
runAutomationEnrich() {
|
||||
return this.automation.runEnrichNow();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user