docs: update documentation for contact form multi-tenant refactoring

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Porwoll 2026-02-17 21:06:27 +00:00
parent 290c2af40f
commit 101ee0abed
2 changed files with 28 additions and 3 deletions

View file

@ -218,6 +218,18 @@ await redis.keys('posts:*').then(keys => keys.length && redis.del(...keys)) //
Die FormSubmissions Collection wurde zu einem leichtgewichtigen CRM erweitert.
**Multi-Tenant Kontaktformular-System:**
- `forms` und `form-submissions` sind tenant-scoped (via `multiTenantPlugin` mit `customTenantField: true`)
- Formulare werden in der CMS Admin-UI pro Tenant erstellt (Forms Collection)
- E-Mail-Empfänger werden pro Formular konfiguriert (Built-in Plugin Feature)
- `ContactFormBlock` referenziert ein Formular aus der Forms Collection (statt hardcoded E-Mail)
- Frontends posten an `/api/form-submissions` mit der `formId` aus dem Block
**Hooks:**
- `setSubmissionTenant` (beforeChange): Kopiert den Tenant automatisch vom Formular auf die Einsendung
- `sendFormNotification` (afterChange): Sendet E-Mail-Benachrichtigungen via Tenant-SMTP an konfigurierte Empfänger
- `formSubmissionBeforeChange`: Auto-Markierung als gelesen, Auto-Autor bei Notizen
**Status-Workflow:** Neu → Gelesen → In Bearbeitung → Warten → Erledigt → Archiviert
**Features:**
@ -229,8 +241,11 @@ Die FormSubmissions Collection wurde zu einem leichtgewichtigen CRM erweitert.
- Auto-Markierung als gelesen beim ersten Öffnen
**Dateien:**
- `src/collections/FormSubmissionsOverrides.ts` - Feld-Definitionen
- `src/hooks/formSubmissionHooks.ts` - Automatisierungen
- `src/collections/FormSubmissionsOverrides.ts` - Feld-Definitionen + Tenant-Feld
- `src/hooks/setSubmissionTenant.ts` - Auto-Tenant-Zuweisung von Form → Submission
- `src/hooks/sendFormNotification.ts` - E-Mail-Benachrichtigung via Tenant-SMTP
- `src/hooks/formSubmissionHooks.ts` - Automatisierungen (Gelesen-Status, Notiz-Autor)
- `src/blocks/ContactFormBlock.ts` - Block mit Formular-Referenz + Anzeigeoptionen
## Community Management System

View file

@ -198,7 +198,8 @@ Organisation: **complexcaresolutions** (Public Frontend-Repos)
### Kurzfristig
8. [ ] porwoll.de: Fehlende Blocks implementieren (~6 Blocks via Work Orders)
8. [x] ~~Kontaktformular: Multi-Tenant Refactoring + Production Deployment~~
9. [ ] porwoll.de: Fehlende Blocks implementieren (~6 Blocks via Work Orders)
9. [ ] blogwoman.de: Types-Bridge durch direkte Contracts-Imports ersetzen
10. [ ] blogwoman.de: YouTube-Serien-Integration vervollständigen
@ -293,6 +294,15 @@ ssh hetzner2 "cd /var/www/vhosts/porwoll.de/httpdocs && git log --oneline -3"
## 📝 Änderungsprotokoll
### 17.02.2026
- **Kontaktformular Multi-Tenant Refactoring:**
- `forms` + `form-submissions` tenant-scoped via `multiTenantPlugin` (customTenantField)
- `ContactFormBlock` refaktoriert: Formular-Referenz statt hardcoded `recipientEmail`
- `setSubmissionTenant` Hook: Tenant auto-propagation Form → Submission
- `sendFormNotification` Hook: E-Mail-Benachrichtigung via Tenant-SMTP
- `FormSubmissionsOverrides`: Tenant-Feld, Status-Workflow, Notizen, Antwort-Tracking
- Migration: `20260217_120000_add_tenant_to_forms.ts`
- Production (porwoll.de): Formular erstellt, Block verknüpft, E2E getestet (inkl. E-Mail-Empfang)
- Plesk Hetzner 2: `NEXT_PUBLIC_TENANT_ID` von 1 auf 4 korrigiert (war Ursache für site-wide 404s)
- **Globaler Typecheck stabilisiert (Commit `4386ac5`):**
- Payload-Typen neu generiert (`src/payload-types.ts`) und Typkonflikte über API-Routen, Integrationen, Monitoring und Reporting bereinigt
- `community-interactions` Sync-Pfade (YouTube/Facebook/Instagram) auf Pflichtfelder und kompatible Literal-Typen angepasst