feat(watcher): Ajout watcher de fichiers temps réel

- Migration 0006: colonne watcher_enabled
- Crate notify pour surveillance FS temps réel (FSEvents/inotify)
- Watcher redémarré toutes les 30s si config change
- Détection instantanée création/modification/suppression
- Création job immédiate quand fichier détecté
- API: support watcher_enabled dans UpdateMonitoringRequest
- Backoffice: toggle Watcher avec indicateur 
- Fonctionne en parallèle du scheduler auto-scan

Usage: Activer Watcher + Auto-scan pour réactivité max
This commit is contained in:
2026-03-06 11:49:53 +01:00
parent 6e0a77fae0
commit 75f7de2e43
8 changed files with 340 additions and 25 deletions

View File

@@ -7,6 +7,7 @@ export type LibraryDto = {
monitor_enabled: boolean;
scan_mode: string;
next_scan_at: string | null;
watcher_enabled: boolean;
};
export type IndexJobDto = {
@@ -135,10 +136,17 @@ export async function scanLibrary(libraryId: string, full?: boolean) {
});
}
export async function updateLibraryMonitoring(libraryId: string, monitorEnabled: boolean, scanMode: string) {
export async function updateLibraryMonitoring(libraryId: string, monitorEnabled: boolean, scanMode: string, watcherEnabled?: boolean) {
const body: { monitor_enabled: boolean; scan_mode: string; watcher_enabled?: boolean } = {
monitor_enabled: monitorEnabled,
scan_mode: scanMode,
};
if (watcherEnabled !== undefined) {
body.watcher_enabled = watcherEnabled;
}
return apiFetch<LibraryDto>(`/libraries/${libraryId}/monitoring`, {
method: "PATCH",
body: JSON.stringify({ monitor_enabled: monitorEnabled, scan_mode: scanMode })
body: JSON.stringify(body)
});
}