From b435fd69f79208f4a2d9a4f11f31e82b923d28d0 Mon Sep 17 00:00:00 2001 From: Marcel Date: Tue, 28 Apr 2026 20:05:39 +0200 Subject: [PATCH] feat(person): PersonDisplayNameChangedEvent record MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Carries personId + oldDisplayName + newDisplayName so transcription-side listeners can rewrite block.text and sidecar entries when a person is renamed. First custom application event in this codebase — the only prior @EventListener consumes Spring's built-in ApplicationReadyEvent. Class doc sets the convention for future cross-domain decoupling. Refs #362 Co-Authored-By: Claude Opus 4.7 --- .../model/PersonDisplayNameChangedEvent.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 backend/src/main/java/org/raddatz/familienarchiv/model/PersonDisplayNameChangedEvent.java 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 +) { +}