Fixed event/all and event/del endpoints

This commit is contained in:
2022-01-19 00:16:23 +01:00
parent 7a119a8aed
commit 78505097db
5 changed files with 70 additions and 27 deletions

View File

@@ -13,26 +13,32 @@ public class MainApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
scene.getStylesheets().add(Objects.requireNonNull(
MainApplication.class.getResource("main-view.css")).toExternalForm());
stage.setTitle("SharePlaner");
stage.setScene(scene);
System.out.println("Ignore 'Illegal reflective access operation'-Warning. See https://github.com/sshahine/JFoenix/issues/1170");
// Load login-scene
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
sceneLogin.getStylesheets().add(Objects.requireNonNull(
MainApplication.class.getResource("../users/login.css")).toExternalForm());
MainApplication.class.getResource("../users/login.css")).toExternalForm()
);
Stage stageLogin = new Stage();
stageLogin.setTitle("Anmelden");
stageLogin.setScene(sceneLogin);
stageLogin.showAndWait();
if (DataController.USER_ID >= 0) {
// Load main-scene
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
scene.getStylesheets().add(Objects.requireNonNull(
MainApplication.class.getResource("main-view.css")).toExternalForm()
);
stage.setTitle("SharePlaner");
stage.setScene(scene);
stage.show();
System.out.println("Logged in...");
}
}

View File

@@ -56,7 +56,7 @@ public class MainController {
}
DataController dataController = new DataController();
ArrayList<Event> eventList = dataController.getAllVisibleEvents();
ArrayList<Event> eventList = dataController.getAllVisibleEvents(weekStartDateTime, weekStartDateTime.plusDays(7));
for (Event event : eventList) {
addEvent(event);
@@ -143,7 +143,7 @@ public class MainController {
deleteBtn.setTextValue(" X ");
deleteBtn.setOnAction(e -> {
DataController dataController = new DataController();
dataController.deleteEvent(event.getId());
dataController.deleteEvent(event.getOwnerId(), event.getId(), event.getDate());
updateEvents();
});
Button editBtn = new Button();