menus de la semaine
This commit is contained in:
parent
ab30810e07
commit
623c744ee9
@ -45,7 +45,7 @@ public class MembreController {
|
|||||||
|
|
||||||
// Récupère tout les membres de la base
|
// Récupère tout les membres de la base
|
||||||
@GetMapping(value = "/all")
|
@GetMapping(value = "/all")
|
||||||
@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
||||||
public ResponseEntity<?> getAll(){
|
public ResponseEntity<?> getAll(){
|
||||||
List<Membre> liste = null;
|
List<Membre> liste = null;
|
||||||
try
|
try
|
||||||
|
@ -67,11 +67,15 @@ public class MenuController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Mise a jour d'un menu par son ID
|
//Mise a jour d'un menu par son ID
|
||||||
@PutMapping("/update/{id}")
|
@PutMapping("/update/{team_id}/{id}")
|
||||||
//@PreAuthorize("hasRole('ROLE_PARENT')")
|
//@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;
|
Menu resultMenu = null;
|
||||||
try {
|
try {
|
||||||
|
menu.setId(menuRepository.findById(id).get().getId());
|
||||||
|
Team team=new Team();
|
||||||
|
team.setId(team_id);
|
||||||
|
menu.setTeam(team);
|
||||||
resultMenu = menuRepository.save(menu);
|
resultMenu = menuRepository.save(menu);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -12,6 +12,7 @@ public class Menu {
|
|||||||
private int id;
|
private int id;
|
||||||
private String libelle;
|
private String libelle;
|
||||||
private LocalDate dateMenu;
|
private LocalDate dateMenu;
|
||||||
|
private String repas;
|
||||||
// private int validationProposition;
|
// private int validationProposition;
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name="TEAM_ID")
|
@JoinColumn(name="TEAM_ID")
|
||||||
@ -21,10 +22,10 @@ public class Menu {
|
|||||||
public 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.libelle = libelle;
|
||||||
this.dateMenu = dateMenu;
|
this.dateMenu = dateMenu;
|
||||||
//this.validationProposition=validationProposition;
|
this.repas= repas;
|
||||||
this.team = team;
|
this.team = team;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,14 @@ public class Menu {
|
|||||||
this.dateMenu = dateMenu;
|
this.dateMenu = dateMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRepas() {
|
||||||
|
return repas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRepas(String repas) {
|
||||||
|
this.repas = repas;
|
||||||
|
}
|
||||||
|
|
||||||
// public int getValidationProposition() {
|
// public int getValidationProposition() {
|
||||||
// return validationProposition;
|
// return validationProposition;
|
||||||
//}
|
//}
|
||||||
@ -75,6 +84,7 @@ public class Menu {
|
|||||||
", libelle='" + libelle + '\'' +
|
", libelle='" + libelle + '\'' +
|
||||||
", dateMenu=" + dateMenu +
|
", dateMenu=" + dateMenu +
|
||||||
", team=" + team +
|
", team=" + team +
|
||||||
|
", repas=" + repas +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user