diff --git a/src/main/java/fr/organizee/controller/MembreController.java b/src/main/java/fr/organizee/controller/MembreController.java index 93df3d8..6fd0b3c 100644 --- a/src/main/java/fr/organizee/controller/MembreController.java +++ b/src/main/java/fr/organizee/controller/MembreController.java @@ -45,7 +45,7 @@ public class MembreController { // Récupère tout les membres de la base @GetMapping(value = "/all") - @PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')") + //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')") public ResponseEntity getAll(){ List liste = null; try diff --git a/src/main/java/fr/organizee/controller/MenuController.java b/src/main/java/fr/organizee/controller/MenuController.java index 0ea98e3..4b18a32 100644 --- a/src/main/java/fr/organizee/controller/MenuController.java +++ b/src/main/java/fr/organizee/controller/MenuController.java @@ -67,11 +67,15 @@ public class MenuController { } //Mise a jour d'un menu par son ID - @PutMapping("/update/{id}") + @PutMapping("/update/{team_id}/{id}") //@PreAuthorize("hasRole('ROLE_PARENT')") - public ResponseEntity updateMenu(@RequestBody Menu menu, @PathVariable Integer id) throws Exception { + public ResponseEntity updateMenu(@RequestBody Menu menu, @PathVariable Integer team_id, @PathVariable Integer id) throws Exception { Menu resultMenu = null; try { + menu.setId(menuRepository.findById(id).get().getId()); + Team team=new Team(); + team.setId(team_id); + menu.setTeam(team); resultMenu = menuRepository.save(menu); } catch (Exception e) { diff --git a/src/main/java/fr/organizee/model/Menu.java b/src/main/java/fr/organizee/model/Menu.java index 22a1ab1..458e80c 100644 --- a/src/main/java/fr/organizee/model/Menu.java +++ b/src/main/java/fr/organizee/model/Menu.java @@ -12,6 +12,7 @@ public class Menu { private int id; private String libelle; private LocalDate dateMenu; + private String repas; // private int validationProposition; @ManyToOne @JoinColumn(name="TEAM_ID") @@ -21,10 +22,10 @@ public class Menu { public Menu() { } - public Menu(String libelle, LocalDate dateMenu, Team team) { + public Menu(String libelle, LocalDate dateMenu,String repas, Team team) { this.libelle = libelle; this.dateMenu = dateMenu; - //this.validationProposition=validationProposition; + this.repas= repas; this.team = team; } @@ -52,6 +53,14 @@ public class Menu { this.dateMenu = dateMenu; } + public String getRepas() { + return repas; + } + + public void setRepas(String repas) { + this.repas = repas; + } + // public int getValidationProposition() { // return validationProposition; //} @@ -75,6 +84,7 @@ public class Menu { ", libelle='" + libelle + '\'' + ", dateMenu=" + dateMenu + ", team=" + team + + ", repas=" + repas + '}'; } }