From 0a0bc34e38ebee2ea302bfa09f3b01c1d0950ce1 Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sun, 31 May 2020 23:29:13 +0200 Subject: [PATCH] Fix today endpoint to only show entries for today Add more sample data --- .../java/de/hft/geotime/repositories/RecordRepository.java | 2 +- backend/src/main/resources/data.sql | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/de/hft/geotime/repositories/RecordRepository.java b/backend/src/main/java/de/hft/geotime/repositories/RecordRepository.java index a7e1822..fb715ff 100644 --- a/backend/src/main/java/de/hft/geotime/repositories/RecordRepository.java +++ b/backend/src/main/java/de/hft/geotime/repositories/RecordRepository.java @@ -45,7 +45,7 @@ public interface RecordRepository extends PagingAndSortingRepository (current_date-1)") + @Query("SELECT record from TimeRecord record where record.account.user.username = :#{principal} AND record.enddate > current_date") Page today(Pageable pageable); @RestResource(rel = "openEntries", path = "openEntries") diff --git a/backend/src/main/resources/data.sql b/backend/src/main/resources/data.sql index 84c0f16..7fb7b97 100644 --- a/backend/src/main/resources/data.sql +++ b/backend/src/main/resources/data.sql @@ -29,6 +29,11 @@ INSERT INTO time_record (id, enddate, startdate, `type`, account_id) VALUES (1, '2020-05-10 16:00:00', '2020-05-10 12:00:00', 0, 1), (2, '2020-05-09 16:00:00', '2020-05-09 12:00:00', 1, 1), (3, '2020-05-20 16:00:00', '2020-05-20 00:00:00', 1, 2), - (4, '2020-05-11 16:00:00', '2020-05-11 12:00:00', 1, 3); + (4, '2020-05-11 16:00:00', '2020-05-11 12:00:00', 1, 1), + (5, '2020-05-30 16:00:00', '2020-05-30 12:00:00', 1, 1), + (6, '2020-05-30 23:00:00', '2020-05-30 22:00:00', 1, 1), + (7, '2020-05-31 01:00:00', '2020-05-31 00:00:00', 1, 1), + (8, '2020-05-31 04:00:00', '2020-05-31 02:00:00', 1, 1), + (9, '2020-05-31 16:00:00', '2020-05-31 12:00:00', 1, 1); SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file