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 b31685b79d
commit aef63bcec3

View file

@ -35,6 +35,16 @@ public class ApiController implements DefaultApi {
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
public ResponseEntity<GetAllProjectsDTO> getAllProjects() {
GetAllProjectsDTO response = new GetAllProjectsDTO();