From 8382b80e0e44e67e4cbef47cf3bb8975d561c3b0 Mon Sep 17 00:00:00 2001 From: Marc Beyer Date: Sun, 28 Nov 2021 15:14:11 +0100 Subject: [PATCH] Get all relevant data form all-events --- server/src/main/java/com/vpr/server/EventRepository.java | 4 +++- server/src/main/java/com/vpr/server/MainController.java | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/com/vpr/server/EventRepository.java b/server/src/main/java/com/vpr/server/EventRepository.java index d3f1c77..7f9b86e 100644 --- a/server/src/main/java/com/vpr/server/EventRepository.java +++ b/server/src/main/java/com/vpr/server/EventRepository.java @@ -9,7 +9,9 @@ import java.util.List; // CRUD refers Create, Read, Update, Delete public interface EventRepository extends CrudRepository { - @Query(value = "SELECT e.id AS eid, e.name AS ename, u.id AS uid, u.forename, u.name AS uname " + + @Query(value = "SELECT e.id AS eid, e.name AS ename, e.start, e.end, e.priority , e.is_full_day, " + + "ue.date, " + + "u.id AS uid, u.forename, u.name AS uname " + "FROM event e " + "INNER JOIN user_event ue " + "ON e.id = ue.event_id " + diff --git a/server/src/main/java/com/vpr/server/MainController.java b/server/src/main/java/com/vpr/server/MainController.java index d7bafc6..2afbf77 100644 --- a/server/src/main/java/com/vpr/server/MainController.java +++ b/server/src/main/java/com/vpr/server/MainController.java @@ -58,10 +58,11 @@ public class MainController { return eventRepository.findAllVisibleByUserId(userId); } - // GET-request at /all-events - // returns JSON-data + @GetMapping(path="/all-events-test") public @ResponseBody Iterable getAllEventsTest() { return eventRepository.findAll(); } + + } \ No newline at end of file