feat: auto-move imported emails to IMAP folder and add 90-day cleanup
Build and Push Multi-Platform Images / build-and-push (push) Successful in 41s

- New ImapFolderService moves emails to configurable "importiert" folder
  after successful import, creating the folder if it doesn't exist
- Daily cron at 03:00 moves emails older than 90 days to trash and empties it
- Extract createImapClient() helper in EmailDownloadService
- Add ensurePageCache() with in-flight deduplication to BarcodeScannerService
- InboxService regenerates page cache on-demand when image file is missing
- IMAP_IMPORTED_FOLDER and IMAP_TRASH_FOLDER added to .env.example and docker-compose

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 13:53:56 +02:00
parent 07dfd7e840
commit b1b30fe1dd
8 changed files with 172 additions and 14 deletions
+7 -2
View File
@@ -232,7 +232,7 @@ export class InboxService {
variant: 'preview' | 'thumbnail',
preferredUsername: string | null,
): Promise<string> {
const { doc } = await this.resolveDocument(id, preferredUsername);
const { doc, pdfPath } = await this.resolveDocument(id, preferredUsername);
if (!Number.isInteger(page) || page < 1 || page > doc.PageCount) {
throw new NotFoundException('Seite nicht gefunden');
}
@@ -244,7 +244,12 @@ export class InboxService {
try {
await fs.access(filePath);
} catch {
throw new NotFoundException('Seite nicht gefunden');
try {
await this.barcodeScanner.ensurePageCache(doc.Id, pdfPath);
await fs.access(filePath);
} catch {
throw new NotFoundException('Seite nicht gefunden');
}
}
return filePath;
}