diff --git a/src/main/java/com/maradona/backend/controllers/api/ProjectController.java b/src/main/java/com/maradona/backend/controllers/api/ProjectController.java index 8aa501b..9d65bbb 100644 --- a/src/main/java/com/maradona/backend/controllers/api/ProjectController.java +++ b/src/main/java/com/maradona/backend/controllers/api/ProjectController.java @@ -101,6 +101,7 @@ public class ProjectController { */ @PostMapping({ "/", "" }) public ResponseEntity post(@RequestBody Project project) { + System.out.println(project); Project savedProject = projectActions.saveProject(project); return ResponseEntity.status(HttpStatus.CREATED).body(savedProject); } diff --git a/src/main/java/com/maradona/backend/entities/Employee.java b/src/main/java/com/maradona/backend/entities/Employee.java index f75ddf4..546f917 100644 --- a/src/main/java/com/maradona/backend/entities/Employee.java +++ b/src/main/java/com/maradona/backend/entities/Employee.java @@ -2,6 +2,8 @@ package com.maradona.backend.entities; import jakarta.persistence.*; import lombok.Data; + +import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonManagedReference; import java.time.LocalTime; import java.util.List; @@ -81,6 +83,7 @@ public class Employee { */ @ManyToMany @JoinTable(name = "employee_project", joinColumns = @JoinColumn(name = "employee_eid"), inverseJoinColumns = @JoinColumn(name = "project_pid")) + @JsonBackReference private List projects; /** diff --git a/src/main/java/com/maradona/backend/entities/Project.java b/src/main/java/com/maradona/backend/entities/Project.java index 91471b2..a7cdb98 100644 --- a/src/main/java/com/maradona/backend/entities/Project.java +++ b/src/main/java/com/maradona/backend/entities/Project.java @@ -5,6 +5,8 @@ import lombok.Data; import java.time.LocalDate; import java.util.List; +import com.fasterxml.jackson.annotation.JsonManagedReference; + /** * Represents a project. * @@ -36,6 +38,7 @@ public class Project { * This is a list of references to the employee entity. */ @ManyToMany(mappedBy = "projects") + @JsonManagedReference private List employees; /** diff --git a/src/main/resources/templates/pages/projects/create.html b/src/main/resources/templates/pages/projects/create.html index 75c6a71..d7774e0 100644 --- a/src/main/resources/templates/pages/projects/create.html +++ b/src/main/resources/templates/pages/projects/create.html @@ -16,7 +16,8 @@

Create Project

+
+ + +
+
+ + +
+