Get all relevant data form all-events

This commit is contained in:
Marc Beyer 2021-11-28 15:14:11 +01:00
parent 8ffaf525eb
commit 8382b80e0e
2 changed files with 6 additions and 3 deletions

View File

@ -9,7 +9,9 @@ import java.util.List;
// CRUD refers Create, Read, Update, Delete // CRUD refers Create, Read, Update, Delete
public interface EventRepository extends CrudRepository<Event, Integer> { public interface EventRepository extends CrudRepository<Event, Integer> {
@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 " + "FROM event e " +
"INNER JOIN user_event ue " + "INNER JOIN user_event ue " +
"ON e.id = ue.event_id " + "ON e.id = ue.event_id " +

View File

@ -58,10 +58,11 @@ public class MainController {
return eventRepository.findAllVisibleByUserId(userId); return eventRepository.findAllVisibleByUserId(userId);
} }
// GET-request at /all-events
// returns JSON-data
@GetMapping(path="/all-events-test") @GetMapping(path="/all-events-test")
public @ResponseBody Iterable<com.vpr.server.Event> getAllEventsTest() { public @ResponseBody Iterable<com.vpr.server.Event> getAllEventsTest() {
return eventRepository.findAll(); return eventRepository.findAll();
} }
} }