Commit 51563694 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!162
parents e6e3fca8 ffd7de50
package ee.sm.ti.teis.commongateway.proceedings.violation.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 UpdateViolationStatusPublicDto {
@NotNull
private UUID id;
@Size(min = 3, max = 4000)
private String eliminationExplanation;
@NotNull
private UUID messageId;
}
package ee.sm.ti.teis.commongateway.proceedings.violation.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.proceedings.violation.dto.UpdateViolationStatusPublicDto;
public class UpdateViolationStatusPublicRequest extends AbstractDTO<UpdateViolationStatusPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.UpdateViolationStatusPublicRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.proceedings.violation; package ee.sm.ti.teis.commongateway.proceedings.violation.request;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.violation; package ee.sm.ti.teis.commongateway.proceedings.violation.request;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.violation.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.proceedings.violation.dto.ViolationPublicDto;
public class UpdateViolationStatusPublicResponse extends AbstractDTO<ViolationPublicDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.UpdateViolationStatusPublicResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.proceedings.violation; package ee.sm.ti.teis.commongateway.proceedings.violation.response;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.violation; package ee.sm.ti.teis.commongateway.proceedings.violation.response;
import ee.sm.ti.teis.AbstractDTO; import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO; import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class TaskActionPlanDto {
@NotNull
private LocalDateTime deadline;
private String reference;
@NotBlank
private String description;
@NotBlank
private String responsiblePerson;
private Boolean highPriority;
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.dto;
import lombok.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.UUID;
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class UpdateTaskActionPlanDto extends TaskActionPlanDto {
@NotNull
private UUID id;
@Builder(builderMethodName = "updateTaskActionPlanDtoBuilder")
public UpdateTaskActionPlanDto(LocalDateTime deadline, String reference, String description,
String responsiblePerson, Boolean highPriority, UUID id) {
super(deadline, reference, description, responsiblePerson, highPriority);
this.id = id;
}
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.tasks.task.actionplan.dto.TaskActionPlanDto;
public class CreateTaskActionPlanRequest extends AbstractDTO<TaskActionPlanDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateTaskActionPlanRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.UUID;
public class DeleteTaskActionPlanRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.DeleteTaskActionPlanRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.tasks.task.actionplan.dto.UpdateTaskActionPlanDto;
public class UpdateTaskActionPlanRequest extends AbstractDTO<UpdateTaskActionPlanDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.UpdateTaskActionPlanRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.tasks.task.dto.TaskDto;
public class CreateTaskActionPlanResponse extends AbstractDTO<TaskDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateTaskActionPlanResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class DeleteTaskActionPlanResponse extends AbstractDTO<Void, ErrorDTO> {
public static final String ROUTING_KEY = "api.DeleteTaskActionPlanResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.tasks.task.actionplan.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.tasks.task.dto.TaskDto;
public class UpdateTaskActionPlanResponse extends AbstractDTO<TaskDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.UpdateTaskActionPlanResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
...@@ -19,11 +19,12 @@ public class PatchTaskDto extends TaskRequestParamDto { ...@@ -19,11 +19,12 @@ public class PatchTaskDto extends TaskRequestParamDto {
private String description; private String description;
private TaskStatusType status; private TaskStatusType status;
private ClassifierItemLightDto tag; private ClassifierItemLightDto tag;
private String responsiblePerson;
@Builder(builderMethodName = "patchTaskDtoBuilder") @Builder(builderMethodName = "patchTaskDtoBuilder")
public PatchTaskDto(UUID id, String taskDefinitionCode, UUID dataObjectId, UUID employerId, LocalDateTime deadline, public PatchTaskDto(UUID id, String taskDefinitionCode, UUID dataObjectId, UUID employerId, LocalDateTime deadline,
LocalDateTime deadlineEnd, String description, TaskStatusType status, LocalDateTime deadlineEnd, String description, TaskStatusType status, ClassifierItemLightDto tag,
ClassifierItemLightDto tag) { String responsiblePerson) {
super(id, taskDefinitionCode, dataObjectId); super(id, taskDefinitionCode, dataObjectId);
this.employerId = employerId; this.employerId = employerId;
this.deadline = deadline; this.deadline = deadline;
...@@ -31,6 +32,7 @@ public class PatchTaskDto extends TaskRequestParamDto { ...@@ -31,6 +32,7 @@ public class PatchTaskDto extends TaskRequestParamDto {
this.description = description; this.description = description;
this.status = status; this.status = status;
this.tag = tag; this.tag = tag;
this.responsiblePerson = responsiblePerson;
} }
public boolean isSingle() { public boolean isSingle() {
......
...@@ -40,6 +40,7 @@ public class TaskDto { ...@@ -40,6 +40,7 @@ public class TaskDto {
@Valid @Valid
private TaskDefinitionDto taskDefinition; private TaskDefinitionDto taskDefinition;
private ClassifierItemLightDto tag; private ClassifierItemLightDto tag;
private String responsiblePerson;
private ObjectStatus objectStatus; private ObjectStatus objectStatus;
} }
package ee.sm.ti.teis.commongateway.tasks.task.actionplan;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.tasks.task.actionplan.dto.TaskActionPlanDto;
import ee.sm.ti.teis.commongateway.tasks.task.actionplan.dto.UpdateTaskActionPlanDto;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static java.util.UUID.randomUUID;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class TaskActionPlanControllerTest extends CommonApiGatewayTestBase {
@Autowired
TaskActionPlanController controller;
@Test
void create() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.create(new TaskActionPlanDto(), new RequestMetaDTO()));
}
@Test
void delete() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.delete(randomUUID(), new RequestMetaDTO()));
}
@Test
void update() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.update(randomUUID(), new UpdateTaskActionPlanDto(), new RequestMetaDTO()));
}
}
...@@ -2,6 +2,7 @@ package ee.sm.ti.teis.commongateway.violation; ...@@ -2,6 +2,7 @@ package ee.sm.ti.teis.commongateway.violation;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase; import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.proceedings.violation.ViolationController; import ee.sm.ti.teis.commongateway.proceedings.violation.ViolationController;
import ee.sm.ti.teis.commongateway.proceedings.violation.dto.UpdateViolationStatusPublicDto;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException; import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO; import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -27,4 +28,10 @@ class ViolationControllerTest extends CommonApiGatewayTestBase { ...@@ -27,4 +28,10 @@ class ViolationControllerTest extends CommonApiGatewayTestBase {
controller.getViolation(randomUUID(), new RequestMetaDTO())); controller.getViolation(randomUUID(), new RequestMetaDTO()));
} }
@Test
void updateStatus_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.updateStatus(randomUUID(), new UpdateViolationStatusPublicDto(), new RequestMetaDTO()));
}
} }
package ee.sm.ti.teis.commongateway.proceedings.violation; package ee.sm.ti.teis.commongateway.proceedings.violation;
import ee.sm.ti.teis.commongateway.proceedings.violation.dto.UpdateViolationStatusPublicDto;
import ee.sm.ti.teis.commongateway.proceedings.violation.dto.ViolationPublicDto; import ee.sm.ti.teis.commongateway.proceedings.violation.dto.ViolationPublicDto;
import ee.sm.ti.teis.commongateway.proceedings.violation.request.UpdateViolationStatusPublicRequest;
import ee.sm.ti.teis.commongateway.proceedings.violation.request.ViolationPublicRequest;
import ee.sm.ti.teis.commongateway.proceedings.violation.request.ViolationsPublicRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO; import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -42,11 +46,26 @@ public class ViolationController extends TeisBaseController { ...@@ -42,11 +46,26 @@ public class ViolationController extends TeisBaseController {
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"), @ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")}) @ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@GetMapping(value = "/{id}", produces = APPLICATION_JSON_VALUE) @GetMapping(value = "/{id}", produces = APPLICATION_JSON_VALUE)
public ViolationPublicDto getViolation(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) { public ViolationPublicDto getViolation(@PathVariable UUID id, RequestMetaDTO requestMetaDTO) {
ViolationPublicRequest request = new ViolationPublicRequest(); ViolationPublicRequest request = new ViolationPublicRequest();
request.setPayload(id, requestMetaDTO); request.setPayload(id, requestMetaDTO);
return service.getViolation(request); return service.getViolation(request);
} }
@ApiOperation(value = "${teis.api.messages.proceedings.violations.patch-violation}", response = ViolationPublicDto.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 andmeobjekti ei eksisteeri")})
@PatchMapping("{id}/status")
public ViolationPublicDto updateStatus(@PathVariable UUID id, @RequestBody UpdateViolationStatusPublicDto dto,
RequestMetaDTO requestMetaDTO) {
UpdateViolationStatusPublicRequest request = new UpdateViolationStatusPublicRequest();
dto.setId(id);
request.setPayload(dto, requestMetaDTO);
return service.updateStatus(request);
}
} }
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