merge conflicts

This commit is contained in:
Sana EL HIRI 2022-02-18 17:46:14 +01:00
commit 06e48caac7

View File

@ -20,6 +20,7 @@ public class ContactController {
@Autowired @Autowired
private ContactRepository contactRepo; private ContactRepository contactRepo;
//Récupère les infos d'un contact par son ID
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')") //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
public ResponseEntity<?> findById(@PathVariable int id){ public ResponseEntity<?> findById(@PathVariable int id){
@ -34,6 +35,7 @@ public class ContactController {
return ResponseEntity.status(HttpStatus.OK).body(contact); return ResponseEntity.status(HttpStatus.OK).body(contact);
} }
//Récupère les infos d'un contact par la team ID
@GetMapping(value = "team/{team_id}") @GetMapping(value = "team/{team_id}")
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')") //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
public ResponseEntity<?> findByTeamId(@PathVariable int team_id){ public ResponseEntity<?> findByTeamId(@PathVariable int team_id){
@ -44,10 +46,10 @@ public class ContactController {
} catch (Exception e) { } catch (Exception e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null); return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
} }
return ResponseEntity.status(HttpStatus.OK).body(contacts); return ResponseEntity.status(HttpStatus.OK).body(contacts);
} }
//Ajoute un nouveau contact
@PostMapping(value="/add") @PostMapping(value="/add")
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')") //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
public ResponseEntity<?> addContact(@RequestBody Contact contact){ public ResponseEntity<?> addContact(@RequestBody Contact contact){
@ -61,6 +63,7 @@ public class ContactController {
return ResponseEntity.status(HttpStatus.CREATED).body(resultContact); return ResponseEntity.status(HttpStatus.CREATED).body(resultContact);
} }
//Mise à jour du contact par son ID
@PutMapping("/update/{id}") @PutMapping("/update/{id}")
//@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')") //@PreAuthorize("hasRole('ROLE_PARENT') or hasRole('ROLE_ENFANT')")
public ResponseEntity<?> updateContact(@RequestBody Contact contact, @PathVariable Integer id) throws Exception { public ResponseEntity<?> updateContact(@RequestBody Contact contact, @PathVariable Integer id) throws Exception {
@ -75,6 +78,7 @@ public class ContactController {
return ResponseEntity.status(HttpStatus.OK).body(resultContact); return ResponseEntity.status(HttpStatus.OK).body(resultContact);
} }
//Efface le contact par on ID
@DeleteMapping(value = "/delete/{id}") @DeleteMapping(value = "/delete/{id}")
//@PreAuthorize("hasRole('ROLE_PARENT')") //@PreAuthorize("hasRole('ROLE_PARENT')")
public ResponseEntity<?> deleteContact(@PathVariable int id){ public ResponseEntity<?> deleteContact(@PathVariable int id){