diff --git a/server/src/main/java/com/vpr/server/controller/EventController.java b/server/src/main/java/com/vpr/server/controller/EventController.java index 28cee56..0421abc 100644 --- a/server/src/main/java/com/vpr/server/controller/EventController.java +++ b/server/src/main/java/com/vpr/server/controller/EventController.java @@ -127,13 +127,14 @@ public class EventController { return new ResponseEntity<>("Drr Termin ist doppelt vorhanden. (Um das zu lösen versuche den Termin zu löschen und erneut zu erstellen)", HttpStatus.BAD_REQUEST); } + ResponseEntity error = createEventAndUserEvent(userId, newDate, newName, newStart, newEnd, newPriority, newIsFullDay, newIsPrivate); + if (error != null) return error; + eventRepository.deleteUserEventsById(userId, eventId, date); if(eventDAO.getAllEventsWithId(eventId).size() == 0){ eventRepository.deleteById(eventId); } - ResponseEntity BAD_REQUEST = createEventAndUserEvent(userId, newDate, newName, newStart, newEnd, newPriority, newIsFullDay, newIsPrivate); - if (BAD_REQUEST != null) return BAD_REQUEST; return new ResponseEntity<>("", HttpStatus.OK); }