Inverted creation HTTP status because I am stupid

This commit is contained in:
Alexis Leboeuf
2026-01-09 10:36:10 +01:00
parent 3d00b0ad2d
commit 34f37b99cc
2 changed files with 4 additions and 4 deletions

View File

@@ -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")

View File

@@ -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")