feat: IACE CE-Compliance Module — Normen, Risikobewertung, Production Lines
Major features: - 215 norms library with section references + Beuth URLs (A/B1/B2/C norms) - 173 hazard patterns with detail fields (scenario, trigger, harm, zone) - Deterministic pattern matching: Component × Lifecycle × Pattern cross-product - SIL/PL auto-calculation from S×E×P risk graph - Risk assessment table with editable S/E/P dropdowns - Production Line Dashboard with animated station flow (Running Dots) - IACE process flow + norms coverage on start page - Non-blocking cookie banner, ProcessFlow SSR fix - 104 Playwright E2E tests passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -157,6 +157,58 @@ func (s *Store) ListMitigations(ctx context.Context, hazardID uuid.UUID) ([]Miti
|
||||
return mitigations, nil
|
||||
}
|
||||
|
||||
// ListMitigationsByProject lists all mitigations for all hazards in a project.
|
||||
func (s *Store) ListMitigationsByProject(ctx context.Context, projectID uuid.UUID) ([]Mitigation, error) {
|
||||
rows, err := s.pool.Query(ctx, `
|
||||
SELECT
|
||||
m.id, m.hazard_id, m.reduction_type, m.name, m.description,
|
||||
m.status, m.verification_method, m.verification_result,
|
||||
m.verified_at, m.verified_by,
|
||||
m.created_at, m.updated_at
|
||||
FROM iace_mitigations m
|
||||
JOIN iace_hazards h ON h.id = m.hazard_id
|
||||
WHERE h.project_id = $1
|
||||
ORDER BY m.created_at ASC
|
||||
`, projectID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list mitigations by project: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
var mitigations []Mitigation
|
||||
for rows.Next() {
|
||||
var m Mitigation
|
||||
var reductionType, status, verificationMethod string
|
||||
|
||||
err := rows.Scan(
|
||||
&m.ID, &m.HazardID, &reductionType, &m.Name, &m.Description,
|
||||
&status, &verificationMethod, &m.VerificationResult,
|
||||
&m.VerifiedAt, &m.VerifiedBy,
|
||||
&m.CreatedAt, &m.UpdatedAt,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("list mitigations by project scan: %w", err)
|
||||
}
|
||||
|
||||
m.ReductionType = ReductionType(reductionType)
|
||||
m.Status = MitigationStatus(status)
|
||||
m.VerificationMethod = VerificationMethod(verificationMethod)
|
||||
|
||||
mitigations = append(mitigations, m)
|
||||
}
|
||||
|
||||
return mitigations, nil
|
||||
}
|
||||
|
||||
// DeleteMitigation deletes a mitigation by ID.
|
||||
func (s *Store) DeleteMitigation(ctx context.Context, id uuid.UUID) error {
|
||||
_, err := s.pool.Exec(ctx, `DELETE FROM iace_mitigations WHERE id = $1`, id)
|
||||
if err != nil {
|
||||
return fmt.Errorf("delete mitigation: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMitigation fetches a single mitigation by ID.
|
||||
func (s *Store) GetMitigation(ctx context.Context, id uuid.UUID) (*Mitigation, error) {
|
||||
return s.getMitigation(ctx, id)
|
||||
|
||||
Reference in New Issue
Block a user