refactor to use Instant instead of LocalDateTime
LocationBasedServices/sumoc-backend/pipeline/head This commit looks good

This commit is contained in:
2026-01-07 23:56:50 +01:00
parent bda244a2e8
commit e88d651c71
15 changed files with 55 additions and 52 deletions
@@ -8,7 +8,8 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
@@ -36,9 +37,9 @@ public class RouteDTO {
@Schema(description = "The longitude of the end address.")
private double endLon;
@Schema(description = "The start date and time of the route.")
private LocalDateTime startDateTime;
private Instant startDateTime;
@Schema(description = "The end date and time of the route.")
private LocalDateTime endDateTime;
private Instant endDateTime;
@Schema(description = "The steps the route consists of.")
private List<StepDTO> steps;
@Schema(description = "Amount of CO2e savings in gramm compared to a car trip for the same route.")
@@ -46,7 +47,7 @@ public class RouteDTO {
@Schema(description = "The temporal difference in minutes compared to the original route the user requested alternatives for.")
private double timeDifferenceSeconds;
public RouteDTO(AddressDTO startAddress, @Nullable String firstStopName, double startLat, double startLon, AddressDTO endAddress, @Nullable String lastStopName, double endLat, double endLon, LocalDateTime startDateTime, LocalDateTime endDateTime, List<StepDTO> steps, double co2Savings, double timeDifferenceSeconds) {
public RouteDTO(AddressDTO startAddress, @Nullable String firstStopName, double startLat, double startLon, AddressDTO endAddress, @Nullable String lastStopName, double endLat, double endLon, Instant startDateTime, Instant endDateTime, List<StepDTO> steps, double co2Savings, double timeDifferenceSeconds) {
this.startAddress = startAddress;
this.firstStopName = firstStopName;
this.startLat = startLat;
@@ -101,8 +102,8 @@ public class RouteDTO {
"Viehhofer Platz",
51.459167,
7.014928,
LocalDateTime.now().minusMinutes(30),
LocalDateTime.now(),
Instant.now().minus(Duration.ofMinutes(30)),
Instant.now(),
new ArrayList<StepDTO>(),
120.5f,
+16.3f