feat: Add application form seed

This commit is contained in:
2026-01-21 06:29:54 +01:00
parent 8350a1bd5d
commit e7633f9bc4
6 changed files with 1054 additions and 23 deletions

View File

@@ -133,13 +133,44 @@ pnpm run api:generate # Frontend
---
## Seed Data Maintenance
The application automatically seeds initial data on first startup:
### 1. Template Seeding
**Seeder:** `InitialApplicationFormTemplateSeeder`
**File:** `legalconsenthub-backend/src/main/resources/seed/initial_application_form_template.yaml`
**Condition:** Seeds if no templates exist (`isTemplate = true`)
**Purpose:** Comprehensive IT system approval workflow template
**IMPORTANT:** Keep this file updated when form structure or validation rules change.
### 2. Application Form Seeding
**Seeder:** `InitialApplicationFormSeeder`
**File:** `legalconsenthub-backend/src/main/resources/seed/initial_application_form.yaml`
**Condition:** Seeds if no forms exist for empty organizationId (`isTemplate = false`)
**Purpose:** Realistic SAP S/4HANA application form for development and UI testing
**organizationId:** Empty string (global form visible to all organizations)
**Content:** Pre-filled IT system introduction form based on the template structure with realistic SAP S/4HANA values
**IMPORTANT:** Keep this file synchronized with template changes. When template structure changes, update the demo form accordingly.
**Note:**
- Forms with empty/null organizationId act as "global" forms and are visible to all organizations
- This allows the demo form to appear regardless of the current organization context
- The demo form is derived from the template structure with values filled for realistic testing
- Demonstrates visibility conditions, section spawning, clonable elements, and GDPR compliance features
---
## Key Files
| File | Purpose |
|------|---------|
| `api/legalconsenthub.yml` | OpenAPI spec (source of truth) |
| `legalconsenthub-backend/src/main/resources/templates/application_form_latex_template.tex` | PDF template |
| `legalconsenthub-backend/src/main/resources/seed/initial_application_form_template.yaml` | Initial form template |
| `legalconsenthub-backend/src/main/resources/seed/initial_application_form_template.yaml` | Initial form template (isTemplate=true) |
| `legalconsenthub-backend/src/main/resources/seed/initial_application_form.yaml` | SAP S/4HANA demo application form (global, filled with realistic values) |
| `legalconsenthub-backend/src/main/resources/db/changelog/` | Liquibase migrations |
| `.github/workflows/pipeline.yaml` | CI/CD workflow |
@@ -151,7 +182,7 @@ pnpm run api:generate # Frontend
2. **Use mapper classes** for all DTO↔Entity conversions (never in services/controllers)
3. **No hardcoded UI strings** - Use i18n (`de.json`, `en.json`)
4. **API-first** - Modify OpenAPI spec, then regenerate clients
5. **Organization context** - Always consider `organizationId` for multi-tenancy
5. **Organization context** - Always consider `organizationId` for multi-tenancy. Forms with empty/null organizationId are "global" forms visible to all organizations
6. **Form structure is 3-level** - Section → SubSection → Element
7. **Roles managed in Keycloak** - Not in application database
8. **Nuxt UI 4** - For any UI-related questions, use the Nuxt UI MCP server to get current component docs and examples