PMT-37-added Controller Method
This commit is contained in:
parent
cec89e2766
commit
6eb1b5bda8
1 changed files with 22 additions and 0 deletions
|
@ -72,6 +72,28 @@ public class ApiController implements DefaultApi {
|
||||||
return ResponseEntity.ok(response);
|
return ResponseEntity.ok(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseEntity<GetAllProjectInfoDTO> getProjectInfo(Long id){
|
||||||
|
GetAllProjectInfoDTO response = new GetAllProjectInfoDTO();
|
||||||
|
|
||||||
|
Optional<Project> 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
|
@Override
|
||||||
public ResponseEntity<Void> updateProject(Long id, UpdateProjectDTO body) {
|
public ResponseEntity<Void> updateProject(Long id, UpdateProjectDTO body) {
|
||||||
Optional<Project> optionalProject = projectRepository.findById(id);
|
Optional<Project> optionalProject = projectRepository.findById(id);
|
||||||
|
|
Loading…
Reference in a new issue