feat(timeline): derive person life-events (Geburt/Tod/Heirat) — issue #776 #825

Merged
marcel merged 6 commits from worktree-feat-issue-776-derived-person-life-events into main 2026-06-13 15:13:29 +02:00
2 changed files with 39 additions and 0 deletions
Showing only changes of commit 4245b821b9 - Show all commits

View File

@@ -0,0 +1,8 @@
package org.raddatz.familienarchiv.timeline;
/** Discriminator for derived life-events assembled from Person / PersonRelationship data. */
public enum DerivedEventType {
BIRTH,
DEATH,
MARRIAGE
}

View File

@@ -0,0 +1,31 @@
package org.raddatz.familienarchiv.timeline;
import io.swagger.v3.oas.annotations.media.Schema;
import org.raddatz.familienarchiv.document.DatePrecision;
import java.time.LocalDate;
/**
* Unified DTO for timeline entries — covers both curated {@link TimelineEvent} rows
* ({@code derived=false}) and derived life-events assembled from Person/relationship data
* ({@code derived=true}).
*
* <p>The {@code id} field is typed {@code String}, not {@code UUID}, because derived events
* carry synthetic prefixed ids ({@code birth:{uuid}}, {@code death:{uuid}},
* {@code marriage:{uuid}}) that are structurally non-UUID by construction. Any write endpoint
* must reject ids that do not parse as {@code UUID} — enforced and tested in issue #5.
*
* <p>Callers of {@code TimelineService.assembleDerivedEvents()} must independently enforce
* {@code READ_ALL} authorization before invoking that method (see ADR-043).
*/
public record TimelineEntryDTO(
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) String id,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) EventType type,
LocalDate eventDate,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) DatePrecision precision,
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) boolean derived,
DerivedEventType derivedType,
String primaryPersonName,
String relatedPersonName
) {
}