d333ab3d39
- Convert Event and Rsvp from mutable POJOs to Java records - Move all 8 exception classes to application.service.exception sub-package - Add ArchUnit rule enforcing domain models must be records Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
819 B
Java
31 lines
819 B
Java
package de.fete.domain.model;
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.OffsetDateTime;
|
|
import java.time.ZoneId;
|
|
|
|
/** Domain entity representing an event. */
|
|
public record Event(
|
|
Long id,
|
|
EventToken eventToken,
|
|
OrganizerToken organizerToken,
|
|
String title,
|
|
String description,
|
|
OffsetDateTime dateTime,
|
|
ZoneId timezone,
|
|
String location,
|
|
LocalDate expiryDate,
|
|
OffsetDateTime createdAt,
|
|
boolean cancelled,
|
|
String cancellationReason
|
|
) {
|
|
|
|
/** Returns a copy of this event with cancellation applied. */
|
|
public Event withCancellation(boolean cancelled, String cancellationReason) {
|
|
return new Event(
|
|
id, eventToken, organizerToken, title, description,
|
|
dateTime, timezone, location, expiryDate, createdAt,
|
|
cancelled, cancellationReason);
|
|
}
|
|
}
|