diff --git a/pom.xml b/pom.xml
index 86ecd4e..c604703 100644
--- a/pom.xml
+++ b/pom.xml
@@ -34,10 +34,16 @@
org.springframework.boot
spring-boot-starter-data-jpa
+
org.springframework.boot
spring-boot-starter-thymeleaf
+
+ org.thymeleaf.extras
+ thymeleaf-extras-java8time
+ 3.0.4.RELEASE
+
org.projectlombok
diff --git a/src/main/java/de/ph87/data/series/SeriesController.java b/src/main/java/de/ph87/data/series/SeriesController.java
index 27bb414..e9fd36f 100644
--- a/src/main/java/de/ph87/data/series/SeriesController.java
+++ b/src/main/java/de/ph87/data/series/SeriesController.java
@@ -1,5 +1,6 @@
package de.ph87.data.series;
+import jakarta.annotation.Nullable;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -8,16 +9,40 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Comparator;
+import java.util.stream.Stream;
+
@Slf4j
@Controller
@Transactional
@RequiredArgsConstructor
public class SeriesController {
+ private final SeriesRepository seriesRepository;
+
@GetMapping("/")
public String index(@NonNull final Model model) {
-// model.addAttribute("series", getAll());
+ final Stream series = seriesRepository.findAll().stream().sorted(Comparator.comparing(Series::getName));
+ model.addAttribute("series", series);
return "index";
}
+ @Nullable
+ public static String numberFormat(@Nullable final Double value, final int decimals) {
+ if (value == null) {
+ return null;
+ }
+ return "%%.%df".formatted(decimals).formatted(value);
+ }
+
+ @Nullable
+ public static String dateTimeFormat(@Nullable final ZonedDateTime date) {
+ if (date == null) {
+ return null;
+ }
+ return date.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
+ }
+
}
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index 9763163..3fbb1a2 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -1,5 +1,50 @@
-
\ No newline at end of file
+
+
+
+
+ Data
+
+
+
+
+
+
+
+
\ No newline at end of file