PMT-15: Added a deleteProject by ID method

This commit is contained in:
Ole Kück 2024-10-09 10:42:37 +02:00
parent e9e58b821e
commit 165aee2ece
Signed by: SZUT-Ole
GPG key ID: 0A1DF1B37C4A1E4C

View file

@ -35,6 +35,16 @@ public class ApiController implements DefaultApi {
return Optional.empty(); return Optional.empty();
} }
@Override
public ResponseEntity<Void> deleteProject(Long id) {
if (!projectRepository.existsById(id)) {
return ResponseEntity.notFound().build();
}
projectRepository.deleteById(id);
return ResponseEntity.noContent().build();
}
@Override @Override
public ResponseEntity<GetAllProjectsDTO> getAllProjects() { public ResponseEntity<GetAllProjectsDTO> getAllProjects() {
GetAllProjectsDTO response = new GetAllProjectsDTO(); GetAllProjectsDTO response = new GetAllProjectsDTO();