feat(monitoring): T23 - Surveillance automatique des libraries

- Ajout scheduler dans l'indexer (vérifie toutes les minutes)
- Migration 0004: colonnes monitor_enabled, scan_mode, next_scan_at
- API: GET /libraries avec champs monitoring
- API: PATCH /libraries/:id/monitoring pour configuration
- Composant MonitoringForm (client) avec checkbox et select
- Badge Auto/Manual avec couleurs différentes
- Affichage temps restant avant prochain scan
- Proxy route /api/libraries/:id/monitoring

Le scheduler crée automatiquement des jobs quand next_scan_at <= NOW()
This commit is contained in:
2026-03-06 11:42:41 +01:00
parent 5f51955f4d
commit 6e0a77fae0
7 changed files with 302 additions and 1 deletions

View File

@@ -4,6 +4,9 @@ export type LibraryDto = {
root_path: string;
enabled: boolean;
book_count: number;
monitor_enabled: boolean;
scan_mode: string;
next_scan_at: string | null;
};
export type IndexJobDto = {
@@ -132,6 +135,13 @@ export async function scanLibrary(libraryId: string, full?: boolean) {
});
}
export async function updateLibraryMonitoring(libraryId: string, monitorEnabled: boolean, scanMode: string) {
return apiFetch<LibraryDto>(`/libraries/${libraryId}/monitoring`, {
method: "PATCH",
body: JSON.stringify({ monitor_enabled: monitorEnabled, scan_mode: scanMode })
});
}
export async function listJobs() {
return apiFetch<IndexJobDto[]>("/index/status");
}