Commit 1179c8c3 authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Enriko Käsper

See merge request teis/common-api-gateway!153
parents 92c7b2f6 babd1c34
package ee.sm.ti.teis.commongateway.representative.authority;
import ee.sm.ti.teis.commongateway.representative.authority.dto.AuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authority.request.AuthoritiesRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("representatives/authorities")
@RequiredArgsConstructor
public class AuthorityController extends TeisBaseController {
private final AuthorityProcessingService service;
@ApiOperation(value = "${teis.api.representatives.authority.get-list}", response = AuthorityDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust esindaja andmeid saada.")})
@GetMapping
public List<AuthorityDto> getAuthorities(@RequestParam(required = false) Boolean includeAll, RequestMetaDTO requestMetaDTO) {
AuthoritiesRequest request = new AuthoritiesRequest();
request.setPayload(includeAll, requestMetaDTO);
return service.getAuthorities(request);
}
}
package ee.sm.ti.teis.commongateway.representative.authority;
import ee.sm.ti.teis.commongateway.representative.authority.dto.AuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authority.request.AuthoritiesRequest;
import ee.sm.ti.teis.commongateway.representative.authority.response.AuthoritiesResponse;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class AuthorityProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public List<AuthorityDto> getAuthorities(AuthoritiesRequest request) {
AuthoritiesResponse response =
(AuthoritiesResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.representative.authoritypermission;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionAuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.CreateAuthorityPermissionDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.UpdateAuthorityPermissionValidUntilDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.AuthorityPermissionsAuthorityRequest;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.AuthorityPermissionsGrantorRequest;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.CreateAuthorityPermissionRequest;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.UpdateAuthorityPermissionValidUntilRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.types.enums.AuthorityType;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.UUID;
@RestController
@RequestMapping("representatives/authority-permissions")
@RequiredArgsConstructor
public class AuthorityPermissionController extends TeisBaseController {
private final AuthorityPermissionProcessingService service;
@ApiOperation(value = "${teis.api.representatives.authority-permission.create}", response = AuthorityPermissionDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele (puuduvad kohustuslikud väärtused)."),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeid salvestada."),
@ApiResponse(code = 404, message = "Sisendis viidatud isikut ei eksisteeri.")})
@PostMapping
public AuthorityPermissionDto create(@RequestBody CreateAuthorityPermissionDto dto,
RequestMetaDTO requestMetaDTO) {
CreateAuthorityPermissionRequest request = new CreateAuthorityPermissionRequest();
request.setPayload(dto, requestMetaDTO);
return service.create(request);
}
@ApiOperation(value = "${teis.api.representatives.authority-permission.get-by-authority}", response = AuthorityPermissionAuthorityDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust esindaja andmeid saada."),
@ApiResponse(code = 404, message = "Puudub sisendis viidatud andmeobjekt.")})
@GetMapping("authority")
public AuthorityPermissionAuthorityDto getByAuthority(@RequestParam UUID personId,
@RequestParam AuthorityType authorityType,
@RequestParam(required = false) Boolean includeAll,
RequestMetaDTO requestMetaDTO) {
AuthorityPermissionsAuthorityRequest request = new AuthorityPermissionsAuthorityRequest();
request.setPayload(new AuthorityPermissionsAuthorityRequest.Parameters(personId, authorityType, includeAll), requestMetaDTO);
return service.getByAuthority(request);
}
@ApiOperation(value = "${teis.api.representatives.authority-permission.get-by-grantor}", response = AuthorityPermissionDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust esindaja andmeid saada."),
@ApiResponse(code = 404, message = "Puudub sisendis viidatud andmeobjekt.")})
@GetMapping("grantor")
public List<AuthorityPermissionDto> getByGrantor(@RequestParam UUID grantorId,
@RequestParam(required = false) Boolean includeAll,
RequestMetaDTO requestMetaDTO) {
AuthorityPermissionsGrantorRequest request = new AuthorityPermissionsGrantorRequest();
request.setPayload(new AuthorityPermissionsGrantorRequest.Parameters(grantorId, includeAll), requestMetaDTO);
return service.getByGrantor(request);
}
@ApiOperation(value = "${teis.api.representatives.authority-permission.update-valid-until}", response = AuthorityPermissionDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele."),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust esindaja andmeid saada."),
@ApiResponse(code = 404, message = "Puudub sisendis viidatud andmeobjekt.")})
@PatchMapping("{id}")
public AuthorityPermissionDto updateValidUntil(@PathVariable UUID id,
@RequestBody UpdateAuthorityPermissionValidUntilDto dto,
RequestMetaDTO requestMetaDTO) {
UpdateAuthorityPermissionValidUntilRequest request = new UpdateAuthorityPermissionValidUntilRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
return service.updateValidUntil(request);
}
}
package ee.sm.ti.teis.commongateway.representative.authoritypermission;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionAuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.AuthorityPermissionDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.dto.ValidatedAuthorityDto;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.ValidateAuthorityPermissionRequest;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.response.ValidateAuthorityPermissionResponse;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.request.*;
import ee.sm.ti.teis.commongateway.representative.authoritypermission.response.*;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class AuthorityPermissionProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public AuthorityPermissionDto create(CreateAuthorityPermissionRequest request) {
CreateAuthorityPermissionResponse response = (CreateAuthorityPermissionResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public AuthorityPermissionAuthorityDto getByAuthority(AuthorityPermissionsAuthorityRequest request) {
AuthorityPermissionAuthorityResponse response =
(AuthorityPermissionAuthorityResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public List<AuthorityPermissionDto> getByGrantor(AuthorityPermissionsGrantorRequest request) {
AuthorityPermissionGrantorResponse response =
(AuthorityPermissionGrantorResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public ValidatedAuthorityDto validate(ValidateAuthorityPermissionRequest request) {
ValidateAuthorityPermissionResponse response =
(ValidateAuthorityPermissionResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
......@@ -25,4 +60,14 @@ public class AuthorityPermissionProcessingService {
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public AuthorityPermissionDto updateValidUntil(UpdateAuthorityPermissionValidUntilRequest request) {
UpdateAuthorityPermissionValidUntilResponse response =
(UpdateAuthorityPermissionValidUntilResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
......@@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
......@@ -27,14 +26,14 @@ public class AuthorityPermissionTestController extends TeisBaseController {
private final AuthorityPermissionProcessingService service;
@ApiOperation(value = "${teis.api.representatives.authority-permissions.validate}", response = ValidatedAuthorityDto.class)
@ApiOperation(value = "${teis.api.representatives.authority-permission.validate}", response = ValidatedAuthorityDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisend ei vasta nõuetele")})
@GetMapping("validate")
public ValidatedAuthorityDto validate(@RequestParam(name = "personId", required = true) UUID personId,
@RequestParam(name = "grantorId", required = true) UUID grantorId,
@RequestParam(name = "authorityType", required = true) AuthorityType authorityType,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
public ValidatedAuthorityDto validate(@RequestParam(name = "personId") UUID personId,
@RequestParam(name = "grantorId") UUID grantorId,
@RequestParam(name = "authorityType") AuthorityType authorityType,
RequestMetaDTO requestMetaDTO) {
ValidateAuthorityPermissionRequest request = new ValidateAuthorityPermissionRequest();
ValidateAuthorityPermissionDto dto = ValidateAuthorityPermissionDto.builder()
.personId(personId)
......
......@@ -3,12 +3,9 @@ package ee.sm.ti.teis.commongateway.representative.locations;
import ee.sm.ti.teis.commongateway.representative.location.*;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.UUID;
......@@ -21,13 +18,10 @@ public class RepresentativeLocationController extends TeisBaseController {
private final RepresentativeLocationProcessingService service;
@ApiOperation(value = "${teis.api.messages.post-representative-location}", response = RepresentativeLocationLightDto.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "locationId", value = "${teis.api.messages.post-representative-location-id-ex}"),
@ApiImplicitParam(name = "representativeId", value = "${teis.api.messages.post-representative-representative-id-ex}")})
@PostMapping
public List<RepresentativeLocationDto> createRepresentativeLocations(
@RequestBody List<CreateRepresentativeLocationDto> locationDtoList,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
CreateRepresentativeLocationsRequest request = new CreateRepresentativeLocationsRequest();
request.setPayload(new CreateRepresentativeLocationsRequest.Parameters(locationDtoList), requestMetaDTO);
return service.createRepresentativeLocations(request);
......@@ -35,7 +29,7 @@ public class RepresentativeLocationController extends TeisBaseController {
@ApiOperation(value = "${teis.api.messages.delete-representative-location}")
@DeleteMapping("{id}")
public void deleteRepresentativeLocation(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void deleteRepresentativeLocation(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
DeleteRepresentativeLocationRequest request = new DeleteRepresentativeLocationRequest();
request.setPayload(id, requestMetaDTO);
service.deleteRepresentativeLocation(request);
......
......@@ -12,7 +12,6 @@ import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.UUID;
......@@ -30,7 +29,7 @@ public class BusinessTypeController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping
public List<BusinessTypePublicLightDto> getBusinessTypes(@RequestParam(required = false) Boolean includeInactive,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
BusinessTypesPublicRequest request = new BusinessTypesPublicRequest();
request.setPayload(includeInactive, requestMetaDTO);
......@@ -45,7 +44,7 @@ public class BusinessTypeController extends TeisBaseController {
@GetMapping("{id}")
public BusinessTypePublicDto getBusinessType(@PathVariable UUID id, @RequestParam(required = false) Boolean includeInactive,
@RequestParam(required = false) Boolean includeRiskFactors,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
BusinessTypePublicRequest request = new BusinessTypePublicRequest();
request.setPayload(new Parameters(id, includeInactive, includeRiskFactors), requestMetaDTO);
......
package ee.sm.ti.teis.commongateway.riskassessments.riskassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.CopyRiskAssessmentDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.CreateRiskAssessmentDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.RiskAssessmentConclusionDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.RiskAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.UpdateRiskAssessmentStatusDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.UpdateRiskAssessmentTitleDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.dto.*;
import ee.sm.ti.teis.commongateway.riskassessments.riskassessment.request.*;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
......@@ -13,16 +8,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.UUID;
......@@ -39,7 +25,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@PostMapping
public RiskAssessmentPublicDto create(@RequestBody CreateRiskAssessmentDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
CreateRiskAssessmentPublicRequest request = new CreateRiskAssessmentPublicRequest();
request.setPayload(dto, requestMetaDTO);
......@@ -51,7 +37,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@PostMapping("{id}/copy")
public RiskAssessmentPublicDto copy(@PathVariable UUID id, @RequestBody CopyRiskAssessmentDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
CopyRiskAssessmentPublicRequest request = new CopyRiskAssessmentPublicRequest();
dto.setRiskAssessment(RiskAssessmentPublicDto.builder().id(id).build());
request.setPayload(dto, requestMetaDTO);
......@@ -64,7 +50,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping
public List<RiskAssessmentPublicDto> getRiskAssessments(@RequestParam UUID employerId,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
GetRiskAssessmentsPublicRequest request = new GetRiskAssessmentsPublicRequest();
request.setPayload(employerId, requestMetaDTO);
......@@ -79,7 +65,7 @@ public class RiskAssessmentController extends TeisBaseController {
@PatchMapping("{id}/title")
public RiskAssessmentPublicDto updateTitle(@PathVariable UUID id,
@RequestBody UpdateRiskAssessmentTitleDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
UpdateRiskAssessmentTitlePublicRequest request = new UpdateRiskAssessmentTitlePublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
......@@ -93,7 +79,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@GetMapping("{id}/conclusion")
public RiskAssessmentConclusionDto getConclusion(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public RiskAssessmentConclusionDto getConclusion(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
RiskAssessmentConclusionPublicRequest request = new RiskAssessmentConclusionPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -105,7 +91,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping("{id}/business-types")
public RiskAssessmentPublicDto getRiskAssessmentBusinessTypes(@PathVariable UUID id,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
RiskAssessmentBusinessTypePublicRequest request = new RiskAssessmentBusinessTypePublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -117,7 +103,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping("{id}")
public RiskAssessmentPublicDto getRiskAssessment(@PathVariable UUID id,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
GetRiskAssessmentPublicRequest request = new GetRiskAssessmentPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -129,7 +115,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping("{id}/risk-factor-assessments")
public RiskAssessmentPublicDto getRiskFactorAssessment(@PathVariable UUID id,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
RiskAssessmentRiskFactorAssessmentPublicRequest request = new RiskAssessmentRiskFactorAssessmentPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -144,7 +130,7 @@ public class RiskAssessmentController extends TeisBaseController {
@PatchMapping("{id}/status")
public RiskAssessmentPublicDto updateStatus(@PathVariable UUID id,
@RequestBody UpdateRiskAssessmentStatusDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
UpdateRiskAssessmentStatusPublicRequest request = new UpdateRiskAssessmentStatusPublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
......@@ -154,7 +140,7 @@ public class RiskAssessmentController extends TeisBaseController {
@ApiOperation(value = "${teis.api.risk-assessments.risk-assessment.delete}")
@DeleteMapping("{id}")
public void delete(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void delete(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
DeleteRiskAssessmentRequest request = new DeleteRiskAssessmentRequest();
request.setPayload(id, requestMetaDTO);
service.delete(request);
......
......@@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -28,7 +27,7 @@ public class RiskFactorController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@GetMapping
public List<RiskFactorPublicDto> getRiskFactors(@RequestParam(required = false) Boolean includeInactive,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
RiskFactorsPublicRequest request = new RiskFactorsPublicRequest();
request.setPayload(includeInactive, requestMetaDTO);
......
......@@ -25,4 +25,5 @@ public class RiskFactorProcessingService {
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.CreateRiskFactorAssessmentDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.RiskFactorAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.RiskFactorAssessmentPublicLightDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.UpdateRiskFactorAssessmentDescriptionPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.UpdateRiskFactorAssessmentRiskExistsPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.request.CreateRiskFactorAssessmentRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.request.DeleteRiskFactorAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.request.RiskFactorAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.request.UpdateRiskFactorAssessmentDescriptionPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.request.UpdateRiskFactorAssessmentRiskExistsPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.dto.*;
import ee.sm.ti.teis.commongateway.riskassessments.riskfactorassessment.request.*;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import org.springframework.web.bind.annotation.*;
import java.util.UUID;
......@@ -42,7 +26,7 @@ public class RiskFactorAssessmentController extends TeisBaseController {
@ApiResponse(code = 404, message = "Ohu hindamisega seotavat riskianalüüsi või ohu kirjelduse andmeobjekti ei leitud.")})
@PostMapping
public RiskFactorAssessmentPublicDto create(@RequestBody CreateRiskFactorAssessmentDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
CreateRiskFactorAssessmentRequest request = new CreateRiskFactorAssessmentRequest();
request.setPayload(dto, requestMetaDTO);
......@@ -58,7 +42,7 @@ public class RiskFactorAssessmentController extends TeisBaseController {
@PatchMapping("{id}/risk-exists")
public RiskFactorAssessmentPublicLightDto updateRiskExists(@PathVariable UUID id,
@RequestBody UpdateRiskFactorAssessmentRiskExistsPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
UpdateRiskFactorAssessmentRiskExistsPublicRequest request = new UpdateRiskFactorAssessmentRiskExistsPublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
......@@ -71,7 +55,7 @@ public class RiskFactorAssessmentController extends TeisBaseController {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida")})
@DeleteMapping("{id}")
public void delete(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public void delete(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
DeleteRiskFactorAssessmentPublicRequest request = new DeleteRiskFactorAssessmentPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -85,7 +69,7 @@ public class RiskFactorAssessmentController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@GetMapping("{id}")
public RiskFactorAssessmentPublicDto getRiskFactorAssessment(@PathVariable UUID id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
public RiskFactorAssessmentPublicDto getRiskFactorAssessment(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
RiskFactorAssessmentPublicRequest request = new RiskFactorAssessmentPublicRequest();
request.setPayload(id, requestMetaDTO);
......@@ -101,7 +85,7 @@ public class RiskFactorAssessmentController extends TeisBaseController {
@PatchMapping("{id}/description")
public RiskFactorAssessmentPublicLightDto updateDescription(@PathVariable UUID id,
@RequestBody UpdateRiskFactorAssessmentDescriptionPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
RequestMetaDTO requestMetaDTO) {
UpdateRiskFactorAssessmentDescriptionPublicRequest request = new UpdateRiskFactorAssessmentDescriptionPublicRequest();
dto.setId(id);
request<