Merge branch 'dev' into sana
This commit is contained in:
commit
6cabcc4d22
@ -20,6 +20,8 @@ public class ContactController {
|
||||
@Autowired
|
||||
private ContactRepository contactRepo;
|
||||
|
||||
|
||||
//Récupère les infos d'un contact par son ID
|
||||
@GetMapping(value = "/{id}")
|
||||
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
||||
public ResponseEntity<?> findById(@PathVariable int id){
|
||||
@ -34,6 +36,7 @@ public class ContactController {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(contact);
|
||||
}
|
||||
|
||||
//Récupère les infos d'un contact par la team ID
|
||||
@GetMapping(value = "team/{team_id}")
|
||||
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
||||
public ResponseEntity<?> findByTeamId(@PathVariable int team_id){
|
||||
@ -44,10 +47,10 @@ public class ContactController {
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(contacts);
|
||||
}
|
||||
|
||||
//Ajoute un nouveau contact
|
||||
@PostMapping(value="/add")
|
||||
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
||||
public ResponseEntity<?> addContact(@RequestBody Contact contact){
|
||||
@ -61,6 +64,7 @@ public class ContactController {
|
||||
return ResponseEntity.status(HttpStatus.CREATED).body(resultContact);
|
||||
}
|
||||
|
||||
//Mise à jour du contact par son ID
|
||||
@PutMapping("/update/{id}")
|
||||
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
||||
public ResponseEntity<?> updateContact(@RequestBody Contact contact, @PathVariable Integer id) throws Exception {
|
||||
@ -75,6 +79,7 @@ public class ContactController {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(resultContact);
|
||||
}
|
||||
|
||||
//Efface le contact par on ID
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
//@PreAuthorize("hasRole('ROLE_PARENT')")
|
||||
public ResponseEntity<?> deleteContact(@PathVariable int id){
|
||||
|
@ -28,6 +28,7 @@ public class MembreController {
|
||||
|
||||
@Autowired
|
||||
private MembreRepository membreRepo;
|
||||
|
||||
@Autowired
|
||||
private MembreService membreService;
|
||||
@Autowired
|
||||
@ -176,8 +177,6 @@ public class MembreController {
|
||||
}
|
||||
|
||||
/********************* Gestion Mot de Passe ************************************/
|
||||
|
||||
|
||||
//cette methode ne fonctionne pas parce que ça affiche "trouvé" dans tous les cas
|
||||
@GetMapping("/forgot-password")
|
||||
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
|
||||
@ -216,7 +215,4 @@ public class MembreController {
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(resultMembre);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user