Add Event entity, CreateEventCommand, ports (CreateEventUseCase, EventRepository), and EventService with Clock injection for deterministic testing. Expiry date must be in the future. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
574 B
Java
21 lines
574 B
Java
package de.fete.application.service;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
/** Thrown when an event's expiry date is not in the future. */
|
|
public class ExpiryDateInPastException extends RuntimeException {
|
|
|
|
private final LocalDate expiryDate;
|
|
|
|
/** Creates a new exception for the given invalid expiry date. */
|
|
public ExpiryDateInPastException(LocalDate expiryDate) {
|
|
super("Expiry date must be in the future: " + expiryDate);
|
|
this.expiryDate = expiryDate;
|
|
}
|
|
|
|
/** Returns the invalid expiry date. */
|
|
public LocalDate getExpiryDate() {
|
|
return expiryDate;
|
|
}
|
|
}
|