Inverted creation HTTP status because I am stupid
This commit is contained in:
@@ -51,10 +51,10 @@ public class AthleteResource {
|
||||
public ResponseEntity<AthleteDTO> create(@RequestBody AthleteDTO dto) {
|
||||
Athlete athlete = mapToEntity(dto);
|
||||
if(athleteDAO.existsByKeycloakId(athlete.getKeycloakId())) {
|
||||
return ResponseEntity.status(201).body(mapToDTO(athleteDAO.findByKeycloakId(athlete.getKeycloakId()).get()));
|
||||
return ResponseEntity.status(200).body(mapToDTO(athleteDAO.findByKeycloakId(athlete.getKeycloakId()).get()));
|
||||
}
|
||||
athleteDAO.save(athlete);
|
||||
return ResponseEntity.status(200).body(mapToDTO(athlete));
|
||||
return ResponseEntity.status(201).body(mapToDTO(athlete));
|
||||
}
|
||||
|
||||
@Operation(summary = "Récupère tous les athlètes")
|
||||
|
||||
@@ -25,10 +25,10 @@ public class CoachResource {
|
||||
public ResponseEntity<CoachDTO> create(@RequestBody CoachDTO dto) {
|
||||
Coach coach = mapToEntity(dto);
|
||||
if(coachDAO.existsByKeycloakId(coach.getKeycloakId())) {
|
||||
return ResponseEntity.status(201).body(mapToDTO(coachDAO.findByKeycloakId(coach.getKeycloakId()).get()));
|
||||
return ResponseEntity.status(200).body(mapToDTO(coachDAO.findByKeycloakId(coach.getKeycloakId()).get()));
|
||||
}
|
||||
coachDAO.save(coach);
|
||||
return ResponseEntity.status(200).body(mapToDTO(coach));
|
||||
return ResponseEntity.status(201).body(mapToDTO(coach));
|
||||
}
|
||||
|
||||
@GetMapping("/all")
|
||||
|
||||
Reference in New Issue
Block a user