diff --git a/src/main/java/de/hmmh/pmt/ApiController.java b/src/main/java/de/hmmh/pmt/ApiController.java index c29c60b..e388969 100644 --- a/src/main/java/de/hmmh/pmt/ApiController.java +++ b/src/main/java/de/hmmh/pmt/ApiController.java @@ -72,6 +72,28 @@ public class ApiController implements DefaultApi { return ResponseEntity.ok(response); } + @Override + public ResponseEntity getProjectInfo(Long id){ + GetAllProjectInfoDTO response = new GetAllProjectInfoDTO(); + + Optional optionalProject = projectRepository.findById(id); + if (optionalProject.isEmpty()) { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } + Project project = optionalProject.get(); + + response.setId(project.getId()); + response.setName(project.getName()); + response.setGoal(project.getGoal()); + response.setCustomerId(project.getCustomerId()); + response.setAdministratorId(project.getAdministratorId()); + response.setStart(project.getStart()); + response.setPlannedEnd(project.getPlannedEnd()); + + return ResponseEntity.ok(response); + } + + @Override public ResponseEntity updateProject(Long id, UpdateProjectDTO body) { Optional optionalProject = projectRepository.findById(id);