PMT-4 Refactor pmt.yml and addEmployee
All checks were successful
Quality Check / Validate OAS (push) Successful in 55s
Quality Check / Validate OAS (pull_request) Successful in 1m4s
Quality Check / Linting (push) Successful in 2m6s
Quality Check / Linting (pull_request) Successful in 2m11s
Quality Check / Testing (push) Successful in 2m21s
Quality Check / Static Analysis (push) Successful in 2m24s
Quality Check / Testing (pull_request) Successful in 2m17s
Quality Check / Static Analysis (pull_request) Successful in 2m20s

This commit is contained in:
Rajbir Singh 2024-10-21 11:21:19 +02:00
parent 8b0cb91e53
commit f5717076a8
2 changed files with 7 additions and 4 deletions

View file

@ -184,6 +184,8 @@ paths:
$ref: "#/components/responses/UnprocessableContent" $ref: "#/components/responses/UnprocessableContent"
500: 500:
$ref: "#/components/responses/InternalError" $ref: "#/components/responses/InternalError"
503:
$ref: "#/components/responses/ServiceUnavailable"
delete: delete:
operationId: "deleteProject" operationId: "deleteProject"

View file

@ -98,7 +98,6 @@ public class ApiController implements DefaultApi {
@Override @Override
public ResponseEntity<Void> addEmployee(Long id, AddEmployeeDTO body) { public ResponseEntity<Void> addEmployee(Long id, AddEmployeeDTO body) {
Optional<Project> optionalProject = projectRepository.findById(id); Optional<Project> optionalProject = projectRepository.findById(id);
if (optionalProject.isEmpty()) { if (optionalProject.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND); return new ResponseEntity<>(HttpStatus.NOT_FOUND);
@ -111,12 +110,14 @@ public class ApiController implements DefaultApi {
} catch (HttpClientErrorException exception) { } catch (HttpClientErrorException exception) {
return new ResponseEntity<>(exception.getStatusCode().equals(HttpStatus.NOT_FOUND) return new ResponseEntity<>(exception.getStatusCode().equals(HttpStatus.NOT_FOUND)
? HttpStatus.NOT_FOUND ? HttpStatus.NOT_FOUND
: HttpStatus.INTERNAL_SERVER_ERROR); : HttpStatus.SERVICE_UNAVAILABLE);
} catch (RestClientException exception) {
return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
} }
if (employee.getSkillSet() if (employee.getSkillSet()
.stream() .stream()
.anyMatch(qualification -> qualification.getId().equals(body.getQualificationId()))) { .noneMatch(qualification -> qualification.getId().equals(body.getQualificationId()))) {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY); return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
} }