Skip to content
Snippets Groups Projects

Mise à jour des PUT,POST,DELETE en fonction des relations entre les composants

Merged Fatima Ezzahra Majidi requested to merge master into main
13 files
+ 140
12
Compare changes
  • Side-by-side
  • Inline
Files
13
@@ -76,10 +76,17 @@ public class CandidacyController {
@GetMapping("/{id}")
public ResponseEntity<Candidacy> getCandidacyById(@PathVariable Long id) {
return candidacyService.getCandidacyById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
Optional<Candidacy> optionalCandidacy = candidacyService.getCandidacyById(id);
if (optionalCandidacy.isPresent()) {
Candidacy candidacy = optionalCandidacy.get();
candidacy.getStage().getId(); // Ensure Stage ID is included
return ResponseEntity.ok(candidacy);
} else {
return ResponseEntity.notFound().build();
}
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> deleteCandidacy(@PathVariable Long id) {
if (!candidacyService.existsById(id)) {
Loading