feat(router): instrada in sottocartella A/M_B e ottimizza cache destinazione

- Router: aggiunge campo `subfolder` a getCadInfo (91xxxxx → A, 92xxxxx → M_B);
  getDestinationDecision appende la sottocartella al percorso finale
- Scanner (fast path): legge A e M_B dentro ogni cartella a 3 cifre per
  il rilevamento duplicati, anziché la cartella a 3 cifre stessa
- Cache: persistenza su disco del folderIndex; cadKeyIndex sempre fresco
- isCacheStillValid: validazione a due livelli (top-level + cartelle a 3
  cifre) — rileva automaticamente nuove cartelle aggiunte da colleghi
- UI: rimosso pulsante "Riscansiona destinazione"; gestione cache completamente
  automatica e trasparente per l'utente
This commit is contained in:
2026-03-16 16:17:24 +01:00
parent a49d338741
commit 65b1777a60
4 changed files with 204 additions and 23 deletions

View File

@@ -4,6 +4,7 @@ const fs = require('fs-extra');
const { processFolder } = require('./services/folderProcessor');
const { processZip } = require('./services/zipProcessor');
const { setCacheDir, clearCache } = require('./services/destinationScanner');
const {
resolveUnroutedDir,
listUnroutedFiles,
@@ -127,6 +128,7 @@ Menu.setApplicationMenu(Menu.buildFromTemplate([
app.whenReady().then(async () => {
await ensureRuntimeDirectory();
setCacheDir(getRuntimeDirectory());
const persistedDestination = await loadPersistedDestination();
config = buildConfig(persistedDestination);
createWindow();
@@ -224,9 +226,11 @@ ipcMain.handle('update-destination', async (_event, payload) => {
config = buildConfig(destination);
await persistDestination(config.destination);
await clearCache();
return { destination: config.destination };
});
ipcMain.handle('open-unrouted-folder', async () => {
const unroutedDir = await resolveUnroutedDir();
const openResult = await shell.openPath(unroutedDir);