Der Webhook reiht eingehende Dokument-IDs nur noch in eine Warteschlange ein
und antwortet sofort (status "queued"). Ein separater Intervall-Prozess
(WebhookQueueService) arbeitet die IDs nacheinander ab – ohne Überschneidung,
falls ein Dokument mehrfach kurz hintereinander gespeichert wird:
- Jede ID kommt nur einmal in der Liste vor (Dedup).
- Beim Verarbeitungsstart wird die ID sofort entfernt; ein erneutes Feuern
während der Verarbeitung reiht sie wieder ein (ein weiterer Lauf folgt).
- Es läuft immer nur eine Verarbeitung gleichzeitig (isProcessing-Guard).
- Prüfintervall sehr kurz (WEBHOOK_QUEUE_INTERVAL_MS, Default 1000 ms).
Status-Recording (last_webhook_call) + GET /api/webhook/status wandern in den
Queue-Service und liefern zusätzlich die aktuelle Warteschlangen-Größe.
Frontend-Tab zeigt Status "In Warteschlange" und die Queue-Größe an.
Unit-Test deckt Dedup, Remove-on-start, Re-Enqueue und No-Parallel ab.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
processDocumentById verarbeitet nun jedes vom Paperless-Webhook gemeldete
Dokument, unabhängig vom Tag "paperlessmanager" (ID 16). Die Tag-Vorprüfung
(skipped/tag-missing) entfällt. Die Konstante PAPERLESSMANAGER_TAG_ID bleibt
für den manuellen Batch-Lauf processDocuments erhalten.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pro Webhook-Aufruf wird ein Status in der settings-Tabelle gepflegt
(Tag "last_webhook_call", JSON mit Zeitpunkt, Dokument, action, Ergebnis).
Neuer Endpunkt GET /api/webhook/status liefert den letzten Aufruf zum
Auslesen (JWT oder API-Key). Persistent über Neustarts, anders als die
Container-Logs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Statt stündlichem Cron ruft Paperless-NGX nun per Webhook das Backend auf,
sobald ein Dokument bearbeitet wurde. Der Endpunkt verarbeitet ein einzelnes
Dokument (per doc_url/document_id), prüft weiterhin den Tag "paperlessmanager"
(ID 16) und ist per API-Key (X-API-Key) abgesichert, sodass nur Paperless ihn
aufrufen kann.
- paperless-processor.service.ts: @Cron entfernt; neue Methode
processDocumentById; Tag-16 als Konstante; gemeinsamer Helper
processAndEvaluate (Batch + Webhook)
- paperless.module.ts: PaperlessProcessorService exportiert
- webhook.controller.ts: Route auf api/webhook (erreichbar via /api-Proxy);
@Public() -> @UseGuards(ApiKeyGuard); ID-Extraktion aus {{doc_url}}
- webhook.module.ts: PaperlessModule + AuthModule importiert
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a payment step after document approval: PM_Freigabe approves
(Field 15 = "freigegeben"), then PM_Zahlung can mark as paid (Field 16).
- Backend: VIEW_ZAHLUNG permission mapped to PM_Zahlung OIDC group
- Backend: ZahlungModule with endpoints to list documents by filter
(ausstehend/freigegeben/alle), set Field 16, fetch options from Paperless
- Backend: setZahlung() throws ForbiddenException if Field 15 ≠ "freigegeben"
- Frontend: /zahlung route with 3-way filter, two status columns (Freigabe + Zahlung)
- Frontend: "Zahlung verbuchen" button disabled with tooltip for non-approved docs
- Frontend: Zahlung menu item with EuroOutlined icon
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Cleanup-Cron von EmailDownloadService in ImapFolderService verschoben,
damit er auch aus EmailController aufrufbar ist (zirkuläre Abhängigkeit vermieden)
- Beim Klick auf „Anhänge prüfen" wird der IMAP-Cleanup fire-and-forget gestartet
- Beim Klick auf „Bereits verarbeitete Anhänge prüfen" werden zusätzlich alle
E-Mails im IMAP-Posteingang, die in der DB als verarbeitet (Status 1) oder
ignoriert (Status 3) markiert sind, in den Ordner „importiert" verschoben
- Erfolgsmeldung zeigt Anzahl verschobener E-Mails an
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
NODE_ENV=production deaktiviert synchronize (zerstörerischer ADD/DROP-COLUMN-
Churn auf MariaDB, der die 8126-Byte-Zeilengröße sprengte) und aktiviert
migrationsRun. Neue data-source.ts als einzige Konfigquelle (Laufzeit + CLI),
Migrations-Workflow (generate/run/revert) inkl. dotenv ergänzt.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Neuer ImapFolderService verschiebt E-Mails nach erfolgreichem Import in den
konfigurierbaren Ordner "importiert" (wird bei Bedarf automatisch erstellt)
- Täglicher Cron um 03:00 Uhr verschiebt E-Mails älter als 90 Tage in den
Papierkorb und leert ihn anschließend
- createImapClient()-Hilfsmethode im EmailDownloadService ausgelagert
- IMAP_IMPORTED_FOLDER und IMAP_TRASH_FOLDER in docker-compose ergänzt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 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>
- New steuertag_ids setting to mark tags as workflow-only (not editable)
- DocumentEditModal shows only content tags (non-Steuertags) as editable chips
- Backend preserves Steuertags when saving document tag changes
- ManuellBearbeitenPage renders content tag chips under document title
- New Steuertags settings tab with multi-select and color preview
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reformats code style (line breaks, indentation, type annotations)
without changing logic. Also includes minor feature additions bundled
in the same lint run (stats service, user-settings groups, agrarmonitor
polling improvements).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Store UserGroups from OIDC in UserSettings entity, sync on each request
- Filter daily digest tiles based on user's permission groups
- Add in-memory job status tracking to EmailImportService
- Poll import job status in MailImportWizard and show progress in Spin tip
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace table layout with modern card-based design per dashboard area
- Add icon, color accent, badge and "Öffnen" link per card
- Show summary bar with total open items count
- Fix cron timezone to Europe/Berlin
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Read APP_URL and AGRARMONITOR_BASE_URL from config
- Render dashboard entries as clickable links in HTML digest email
- Add APP_URL and DAILY_DIGEST_CRON to .env.example and docker-compose.yml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New DailyDigestModule with scheduled summary email for open dashboard items
- Extract StatsService from StatsController for reuse in digest
- Add DailyDigestEnabled, UserEmail, UserPreferredUsername to UserSettings entity
- Sync email/username from OIDC token on each get/update call
- Add dailyDigestEnabled to UserSettingsDto and update API
- Notifications tab in UserSettingsPage with enable toggle and "Jetzt senden" button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Renamed setting agrarmonitor_tag_posteingang → agrarmonitor_tag_manuell
- Documents not found in AM are now tagged as "Manuell bearbeiten"
instead of being moved back to Posteingang
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Before moving a document back to Posteingang, check if it's still
waiting in the Agrarmonitor Dateieingang
- If yes: skip silently (upload is pending processing)
- If no: move to Posteingang tag as before
- Handle 401/403 by clearing the session and aborting the check
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add agrarmonitor_tag_posteingang setting (default empty)
- When a document is not found in Agrarmonitor, move it back to Posteingang
tag instead of skipping (if tagPosteingang is configured)
- Expose tagPosteingang in polling config API and settings UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Only set eingangsDatum when belegNummer is present
- Import documents when buchungsDatum is set (revert inverted condition)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Raised page_size from 100 to 9999 on GET /api/paperless/correspondents
so the FreigabePage can resolve all correspondent IDs to names.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Paperless may return extra_data.select_options as an array of objects
{id, label} instead of plain strings. This caused React error #31
when Ant Design tried to render an object as a child in the Select and
Table components.
- Backend: coerce option items to {id: string, label: string} regardless
of whether Paperless returns strings or objects
- Frontend: normalize cf.value to a plain string before rendering or
storing in state, guarding against object-typed values
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a dedicated approval view for PM_Freigabe users to release documents
for payment by setting Paperless custom field 15 to a predefined value.
- Backend: VIEW_FREIGABE permission mapped to PM_Freigabe OIDC group
- Backend: FreigabeErforderlich flag on DocumentType entity (auto-migrated)
- Backend: FreigabeModule with endpoints to list documents, fetch field
options dynamically from Paperless, and set the approval custom field
- Frontend: /freigabe route with filter (default: nicht freigegeben),
paginated table, and modal to select approval value
- Frontend: Settings checkbox to mark document types as requiring approval
- Frontend: Freigabe menu item visible only to PM_Freigabe/PM_Admin users
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- getOrCreateCorrespondent first checks CorrespondentSetting by kundenId
- Falls back to name search only when no mapping exists
- Saves the mapping after creation for future polling runs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Detect duplicates after sync (same AgrarmonitorId, multiple correspondents)
- Auto-merge duplicates with identical names (delete empty, move docs to larger)
- Expose conflicts with different names for manual resolution
- New mergeCorrespondents endpoint + service method
- Conflict resolution modal in SettingsPage with radio selection per conflict
- deleteCorrespondent added to PaperlessService
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Extract getOrCreateCorrespondent helper to deduplicate logic
- Add syncCorrespondentIds to match Paperless correspondents to
Agrarmonitor IDs via Lieferantennummer and persist in CorrespondentSetting
- New POST /api/agrarmonitor/sync-correspondents endpoint
- "Agrarmonitor-Abgleich" button in Correspondents settings tab
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- 400 on Korrespondenten-Sync: getCorrespondentByName was called with
searchName "(12345)" but checked exact match against full displayName
"Firma (12345)". Always returned null → duplicate addCorrespondent on
every run → Paperless 400. Fix: search by displayName directly.
- 403 on Livesearch: cached Agrarmonitor session expired. Fix: detect
401/403 from connector, call clearClient() to invalidate cache, break
out of the polling loop so next cron run re-authenticates.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GET /api/settings/clients — list all Betriebe ordered by name
PUT /api/settings/clients/:id — update AgrarmonitorBetriebId
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GET /api/agrarmonitor/polling-config
PUT /api/agrarmonitor/polling-config
POST /api/agrarmonitor/run-polling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Set autoRetry: false and timeoutMs: 10000 in AgrarmonitorService
- Show specific error message on timeout or backend error in frontend
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New backend module (agrarmonitor) with status check and device registration
- Frontend settings tab with connection status display and registration form
- Environment variables for base URLs, credentials, cookie path and encryption key
- Docker Compose env passthrough for agrarmonitor config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>