Fixed event/add endpoint

This commit is contained in:
Marc Beyer 2022-01-19 00:30:13 +01:00
parent 78505097db
commit 2269f05f52
2 changed files with 21 additions and 16 deletions

View File

@ -12,6 +12,7 @@ import javafx.util.converter.LocalTimeStringConverter;
import res.DataController;
import res.Event;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.FormatStyle;
import java.util.Locale;
@ -65,8 +66,8 @@ public class CreateEventController {
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
toggleBtnIsFullDay.isSelected(),
toggleBtnIsPrivate.isSelected(),
timeStart.getValue().toString(),
timeEnd.getValue().toString(),
timeStart.getValue(),
timeEnd.getValue(),
datePickerDate.getValue().atStartOfDay(),
(int) DataController.USER_ID
);

View File

@ -4,9 +4,11 @@ import com.sun.jdi.event.StepEvent;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
import java.sql.SQLOutput;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.regex.Matcher;
@ -95,11 +97,13 @@ public class Event {
int priority,
boolean isFullDay,
boolean isPrivate,
String start,
String end,
LocalTime start,
LocalTime end,
LocalDateTime date,
int ownerId
) throws IllegalArgumentException {
System.out.println("Create Event");
if (name.length() < 3) {
throw new IllegalArgumentException("Der Name muss eine L\u00e4nge von 3 haben.");
}
@ -140,8 +144,8 @@ public class Event {
this.priority = priority;
this.isFullDay = isFullDay;
this.isPrivate = isPrivate;
this.start = start;
this.end = end;
if (start != null) this.start = start.toString();
if (start != null) this.end = end.toString();
this.date = date;
this.ownerId = ownerId;
}
@ -242,7 +246,7 @@ public class Event {
"&name=" + getName() +
"&start=" + getStart() +
"&end=" + getEnd() +
"&prority=" + getPriority() +
"&priority=" + getPriority() +
"&isFullDay=" + isFullDay() +
"&isPrivate=" + isPrivate();
}