PMT-40: Implement Endpoint
All checks were successful
Quality Check / Validate OAS (push) Successful in 53s
Quality Check / Validate OAS (pull_request) Successful in 1m3s
Quality Check / Linting (push) Successful in 2m12s
Quality Check / Linting (pull_request) Successful in 2m13s
Quality Check / Testing (push) Successful in 2m26s
Quality Check / Testing (pull_request) Successful in 2m23s
Quality Check / Static Analysis (push) Successful in 2m33s
Quality Check / Static Analysis (pull_request) Successful in 2m28s
All checks were successful
Quality Check / Validate OAS (push) Successful in 53s
Quality Check / Validate OAS (pull_request) Successful in 1m3s
Quality Check / Linting (push) Successful in 2m12s
Quality Check / Linting (pull_request) Successful in 2m13s
Quality Check / Testing (push) Successful in 2m26s
Quality Check / Testing (pull_request) Successful in 2m23s
Quality Check / Static Analysis (push) Successful in 2m33s
Quality Check / Static Analysis (pull_request) Successful in 2m28s
Co-authored-by: Dominik Säume <dominik.saeume@hmmh.de>
This commit is contained in:
parent
79ab6f7f48
commit
096c25e33b
2 changed files with 28 additions and 0 deletions
|
@ -3,6 +3,7 @@ package de.hmmh.pmt;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import de.hmmh.pmt.db.*;
|
||||
import de.hmmh.pmt.db.Project;
|
||||
import de.hmmh.pmt.dtos.*;
|
||||
import de.hmmh.pmt.employee.ApiClientFactory;
|
||||
import de.hmmh.pmt.employee.dtos.EmployeeResponseDTO;
|
||||
|
@ -237,4 +238,19 @@ public class ApiController implements DefaultApi {
|
|||
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<EmployeeProjectsDTO> getAListOfAllProjectsFromASpecificEmployee(Long id) {
|
||||
List<Allocation> allocationsByEmployee = allocationRepository.findAllByEmployeeId(id);
|
||||
|
||||
Set<Project> projects = allocationsByEmployee.stream()
|
||||
.map(Allocation::getProject)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
EmployeeProjectsDTO response = new EmployeeProjectsDTO();
|
||||
for (Project project : projects) {
|
||||
response.addProjectsItem(mapper.mapProject(project));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,4 +82,16 @@ public class Mapper {
|
|||
project.setPlannedEnd(dto.getPlannedEnd());
|
||||
return project;
|
||||
}
|
||||
public de.hmmh.pmt.dtos.Project mapProject(Project project){
|
||||
de.hmmh.pmt.dtos.Project dto = new de.hmmh.pmt.dtos.Project();
|
||||
dto.setId(project.getId());
|
||||
dto.setName(project.getName());
|
||||
dto.setGoal(project.getGoal());
|
||||
dto.setCustomerId(project.getCustomerId());
|
||||
dto.setAdministratorId(project.getAdministratorId());
|
||||
dto.setStart(project.getStart());
|
||||
dto.setPlannedEnd(project.getPlannedEnd());
|
||||
dto.setRealEnd(project.getRealEnd());
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue