begin switch to WSTO architecture

This commit is contained in:
2025-10-29 13:23:43 +01:00
parent f013ef8438
commit 4aa9cb5b34
8 changed files with 174 additions and 30 deletions

View File

@@ -0,0 +1,28 @@
package de.pnreichmuth.timekeep_backend.wsto;
import de.pnreichmuth.timekeep_backend.entities.Station;
import java.util.Objects;
public record StationWSTO(
String name,
String locationName
) {
public StationWSTO{
Objects.requireNonNull(locationName, "Station has to have a location");
}
public static StationWSTO of(Station station){
return new StationWSTO(
station.getName(),
station.getLocation()
);
}
public static Station toEntity(StationWSTO stationWSTO){
return new Station(
stationWSTO.name(),
stationWSTO.locationName()
);
}
}