Commit 53a55a54 authored by Kristel Meikas's avatar Kristel Meikas
Browse files

Merge branch 'develop' into TEIS-1494

parents 1fc8727e eb8b7b72
......@@ -13,6 +13,7 @@ import lombok.NoArgsConstructor;
public class ClassifierItemSearchFilterDto {
private String definitionId;
private String itemCode;
private String itemName;
private String attributeCode;
private String attributeValue;
private Integer itemLevel;
......
package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PatchRiskStatementAssessmentDescriptionPublicDto {
@NotNull
private UUID riskStatementAssessmentId;
@NotNull
@Size(min = 3)
private String description;
}
package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.PatchRiskStatementAssessmentDescriptionPublicDto;
public class PatchRiskStatementAssessmentDescriptionPublicRequest extends AbstractDTO<PatchRiskStatementAssessmentDescriptionPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.PatchRiskStatementAssessmentDescriptionPublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.RiskStatementAssessmentPublicDto;
public class PatchRiskStatementAssessmentDescriptionPublicResponse extends AbstractDTO<RiskStatementAssessmentPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.PatchRiskStatementAssessmentDescriptionPublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.CreateRiskStatementAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.PatchRiskStatementAssessmentDescriptionPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.RiskStatementAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.CreateRiskStatementAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.DeleteRiskStatementAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.PatchRiskStatementAssessmentDescriptionPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.PatchRiskStatementAssessmentPublicRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
......@@ -11,13 +13,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.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 org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.UUID;
......@@ -74,4 +70,21 @@ public class RiskStatementAssessmentController extends TeisBaseController {
service.delete(request);
}
@ApiOperation(value = "${teis.api.risk-assessments.risk-statement-assessment.patch-description}",
response = RiskStatementAssessmentPublicDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@PatchMapping("{id}/description")
public RiskStatementAssessmentPublicDto updateDescription(@PathVariable UUID id,
@RequestBody PatchRiskStatementAssessmentDescriptionPublicDto dto,
@ApiIgnore RequestMetaDTO requestMetaDTO) {
PatchRiskStatementAssessmentDescriptionPublicRequest request = new PatchRiskStatementAssessmentDescriptionPublicRequest();
dto.setRiskStatementAssessmentId(id);
request.setPayload(dto, requestMetaDTO);
return service.updateDescription(request);
}
}
......@@ -3,9 +3,11 @@ package ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.dto.RiskStatementAssessmentPublicDto;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.CreateRiskStatementAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.DeleteRiskStatementAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.PatchRiskStatementAssessmentDescriptionPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.request.PatchRiskStatementAssessmentPublicRequest;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.response.CreateRiskStatementAssessmentPublicResponse;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.response.DeleteRiskStatementAssessmentPublicResponse;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.response.PatchRiskStatementAssessmentDescriptionPublicResponse;
import ee.sm.ti.teis.commongateway.riskassessments.riskstatementassessment.response.PatchRiskStatementAssessmentPublicResponse;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
......@@ -48,4 +50,14 @@ public class RiskStatementAssessmentProcessingService {
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
public RiskStatementAssessmentPublicDto updateDescription(PatchRiskStatementAssessmentDescriptionPublicRequest request) {
PatchRiskStatementAssessmentDescriptionPublicResponse response =
(PatchRiskStatementAssessmentDescriptionPublicResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
......@@ -139,6 +139,7 @@ teis.api.risk-assessments.risk-assessment.delete: Teenus kustutab riskianalüüs
teis.api.risk-assessments.risk-assessment.copy: Teenus loob uue riskianalüüsi olemasoleva riskianalüüsi kopeerimise teel.
teis.api.risk-assessments.risk-statement-assessment.patch: Teenus salvestab abinõu rakendamise vastuse (kas abinõu on rakendatud). Teenust kasutab iseteenindus, et salvestada kasutaja tehtud valikud.
teis.api.risk-assessments.risk-statement-assessment.patch-description: Teenus salvestab täiendavalt lisatud abinõu kirjelduse muudatuse. Teenust kasutab iseteenindus, et kasutaja saaks korrigeerida vigaselt sisestatud kirjeldust.
teis.api.risk-assessments.risk-statement-assessment.create: Teenus salvestab täiendava abinõu rakendamise andmed. Teenust kasutab iseteenindus, et salvestada kasutaja sisestatud täiendava abinõu rakendamise andmed.
teis.api.risk-assessments.risk-statement-assessment.delete: Teenus kustutab abinõu rakendamise väite kohta antud vastuse. Teenust kasutab iseteenindus, et kasutaja saaks kustutada ekslikult lisatud andmeobjekti.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment