diff --git a/backend/src/main/java/org/raddatz/familienarchiv/model/PersonDisplayNameChangedEvent.java b/backend/src/main/java/org/raddatz/familienarchiv/model/PersonDisplayNameChangedEvent.java new file mode 100644 index 00000000..1b748c1a --- /dev/null +++ b/backend/src/main/java/org/raddatz/familienarchiv/model/PersonDisplayNameChangedEvent.java @@ -0,0 +1,23 @@ +package org.raddatz.familienarchiv.model; + +import java.util.UUID; + +/** + * Published by PersonService when a save changes Person.getDisplayName() — i.e. + * any mutation to the fields that DisplayNameFormatter consumes (title, + * firstName, lastName). Listeners on the transcription side rewrite block text + * and sidecar entries that reference the old name. + * + *

This is the first custom application event in the codebase. The previous + * only listener (OcrTrainingService.recoverOrphanedRuns) listens to Spring's + * built-in ApplicationReadyEvent. Future cross-domain decoupling should follow + * the same shape: record-typed event in model/, listener in the consuming + * domain's service/ package, synchronous @EventListener inside the publisher's + * transaction unless the workload genuinely needs to defer. + */ +public record PersonDisplayNameChangedEvent( + UUID personId, + String oldDisplayName, + String newDisplayName +) { +}