feat(backend): Split seed demo and template files
This commit is contained in:
@@ -31,31 +31,51 @@
|
||||
|
||||
## Seed Data Maintenance
|
||||
|
||||
The application automatically seeds initial data on first startup:
|
||||
The application automatically seeds initial data on first startup. Seed files are split into smaller section files for easier maintenance.
|
||||
|
||||
### File Structure
|
||||
```
|
||||
src/main/resources/seed/
|
||||
├── template/ # Form template (isTemplate=true)
|
||||
│ ├── _main.yaml # Main file with metadata and !include directives
|
||||
│ ├── section_01_*.yaml # Individual section files
|
||||
│ └── ...
|
||||
├── demo/ # Demo form (isTemplate=false)
|
||||
│ ├── _main.yaml
|
||||
│ ├── section_01_*.yaml
|
||||
│ └── ...
|
||||
```
|
||||
|
||||
### !include Directive
|
||||
The `_main.yaml` files use `!include` directives to reference section files:
|
||||
```yaml
|
||||
formElementSections:
|
||||
- !include section_01_angaben_zum_itsystem.yaml
|
||||
- !include section_02_modulbeschreibung.yaml
|
||||
```
|
||||
|
||||
`SplitYamlLoader` merges these files before deserialization.
|
||||
|
||||
### 1. Template Seeding
|
||||
**Seeder:** `InitialApplicationFormTemplateSeeder`
|
||||
**File:** `src/main/resources/seed/initial_application_form_template.yaml`
|
||||
**Directory:** `src/main/resources/seed/template/`
|
||||
**Condition:** Seeds if no templates exist (`isTemplate = true`)
|
||||
**Purpose:** Comprehensive IT system approval workflow template
|
||||
**Purpose:** Comprehensive IT system approval workflow template (16 sections)
|
||||
|
||||
**IMPORTANT:** Keep this file updated when form structure or validation rules change.
|
||||
**IMPORTANT:** Keep section files updated when form structure or validation rules change. After any change, also update the flow diagram at `docs/FORM-FLOW-DIAGRAM.md`.
|
||||
|
||||
### 2. Application Form Seeding
|
||||
**Seeder:** `InitialApplicationFormSeeder`
|
||||
**File:** `src/main/resources/seed/initial_application_form.yaml`
|
||||
**Directory:** `src/main/resources/seed/demo/`
|
||||
**Condition:** Seeds if no forms exist for empty organizationId (`isTemplate = false`)
|
||||
**Purpose:** Realistic SAP S/4HANA application form for development and UI testing
|
||||
**Purpose:** Realistic SAP S/4HANA application form for development and UI testing (11 sections)
|
||||
**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.
|
||||
**IMPORTANT:** Keep demo form synchronized with template changes. When modifying a template section, update the corresponding demo section.
|
||||
|
||||
**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
|
||||
- The demo form demonstrates visibility conditions, section spawning, clonable elements, and GDPR compliance features
|
||||
|
||||
---
|
||||
|
||||
@@ -64,10 +84,12 @@ The application automatically seeds initial data on first startup:
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `src/main/resources/templates/application_form_latex_template.tex` | PDF template |
|
||||
| `src/main/resources/seed/initial_application_form_template.yaml` | Initial form template (isTemplate=true) |
|
||||
| `src/main/resources/seed/initial_application_form.yaml` | SAP S/4HANA demo application form (global, filled with realistic values) |
|
||||
| `src/main/resources/seed/template/` | Form template sections (16 files) |
|
||||
| `src/main/resources/seed/demo/` | Demo form sections (11 files) |
|
||||
| `src/main/kotlin/.../seed/SplitYamlLoader.kt` | YAML merger for !include directives |
|
||||
| `src/main/resources/db/changelog/` | Liquibase migrations |
|
||||
| `src/main/kotlin/com/legalconsenthub/service/ApplicationFormFormatService.kt` | HTML/PDF export logic |
|
||||
| `docs/FORM-FLOW-DIAGRAM.md` | Visual form flow diagram (update after template changes) |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user