feat(iace): "Neu initialisieren" Button + DeleteHazard
- POST /initialize?force=true loescht bestehende Hazards + Mitigations und erstellt sie neu mit aktuellen Betriebszustaenden - Orange "Neu initialisieren" Button auf Interview-Seite (mit Confirm-Dialog) - DeleteHazard Store-Methode (kaskadiert Risk Assessments) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,8 +42,29 @@ func (h *IACEHandler) InitializeProject(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Support ?force=true to clear existing hazards + mitigations before re-init
|
||||
forceReinit := c.Query("force") == "true"
|
||||
|
||||
steps := make([]InitStep, 0, 6)
|
||||
|
||||
// ── Step 0 (optional): Clear existing data for force re-init ──
|
||||
if forceReinit {
|
||||
cleared := 0
|
||||
if mits, _ := h.store.ListMitigationsByProject(ctx, projectID); len(mits) > 0 {
|
||||
for _, m := range mits {
|
||||
_ = h.store.DeleteMitigation(ctx, m.ID)
|
||||
cleared++
|
||||
}
|
||||
}
|
||||
if hazards, _ := h.store.ListHazards(ctx, projectID); len(hazards) > 0 {
|
||||
for _, hz := range hazards {
|
||||
_ = h.store.DeleteHazard(ctx, hz.ID)
|
||||
cleared++
|
||||
}
|
||||
}
|
||||
steps = append(steps, InitStep{Name: "Alte Daten geloescht", Status: "done", Count: cleared})
|
||||
}
|
||||
|
||||
// ── Step 1: Extract narrative from limits_form ──
|
||||
narrativeText := extractNarrativeFromMetadata(project.Metadata)
|
||||
if narrativeText == "" {
|
||||
|
||||
Reference in New Issue
Block a user