Commit 15e855df authored by Kristel Meikas's avatar Kristel Meikas
Browse files

Merge branch 'TEIS-2186' into 'develop'

TEIS-2186: added API endpoint for creating drivers' inspection objects

Closes TEIS-2186

See merge request teis/office-api-gateway!191
parents 83a0fb29 b2fed9af
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateDriversInspectionDto {
@NotNull
private UUID proceedingId;
@NotNull
private UUID proceduralActId;
}
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto;
import ee.sm.ti.teis.commongateway.classifier.ClassifierItemLightDto;
import ee.sm.ti.teis.types.enums.ObjectStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.UUID;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DriversInspectionOfficeDto {
private UUID id;
private UUID proceedingId;
private UUID proceduralActId;
private ClassifierItemLightDto status;
private ObjectStatus objectStatus;
}
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
public class CreateDriversInspectionRequest extends AbstractDTO<CreateDriversInspectionDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateDriversInspectionRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.DriversInspectionOfficeDto;
public class CreateDriversInspectionResponse extends AbstractDTO<DriversInspectionOfficeDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.CreateDriversInspectionResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
\ No newline at end of file
package ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProceedingAndProceduralActExistDto {
private Boolean confirmed;
}
package ee.sm.ti.teis.officegateway.proceedings.proceduralact.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
public class ConfirmProceedingAndProceduralActExistRequest extends AbstractDTO<CreateDriversInspectionDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.ConfirmProceedingAndProceduralActExistRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceduralact.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto.ProceedingAndProceduralActExistDto;
public class ConfirmProceedingAndProceduralActExistResponse extends AbstractDTO<ProceedingAndProceduralActExistDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.ConfirmProceedingAndProceduralActExistResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection;
import com.fasterxml.jackson.core.type.TypeReference;
import ee.sm.ti.teis.gatewaycommon.MockMvcUtil;
import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.DriversInspectionOfficeDto;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.request.CreateDriversInspectionRequest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.test.context.support.WithMockUser;
import static ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase.MOCK_ROLE;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@WithMockUser(roles = MOCK_ROLE)
public class DriversInspectionControllerTest extends OfficeApiGatewayTestBase {
private static final String BASE_URL = "/drivers-inspections/";
@Autowired
MockMvcUtil mockMvcUtil;
@Test
void create_success() {
when(requestProcessingService.sendAndReceive(any(CreateDriversInspectionRequest.class)))
.thenReturn(new DriversInspectionOfficeDto());
mockMvcUtil.testPost(BASE_URL, new CreateDriversInspectionDto(), new TypeReference<DriversInspectionOfficeDto>() {
});
verify(requestProcessingService).sendAndReceive(any(CreateDriversInspectionRequest.class));
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceduralact;
import com.fasterxml.jackson.core.type.TypeReference;
import ee.sm.ti.teis.gatewaycommon.MockMvcUtil;
import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto.ProceedingAndProceduralActExistDto;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.request.ConfirmProceedingAndProceduralActExistRequest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.test.context.support.WithMockUser;
import static ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase.MOCK_ROLE;
import static java.util.UUID.randomUUID;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@WithMockUser(roles = MOCK_ROLE)
class ProceduralActTestControllerTest extends OfficeApiGatewayTestBase {
private static final String BASE_URL = "/procedural-acts/test/";
@Autowired
MockMvcUtil mockMvcUtil;
@Test
void confirmExist_success() {
when(requestProcessingService.sendAndReceive(any(ConfirmProceedingAndProceduralActExistRequest.class)))
.thenReturn(new ProceedingAndProceduralActExistDto());
parameters.add("proceedingId", randomUUID().toString());
parameters.add("proceduralActId", randomUUID().toString());
mockMvcUtil.testGet(BASE_URL + "exist", parameters, new TypeReference<ProceedingAndProceduralActExistDto>() {
});
verify(requestProcessingService).sendAndReceive(any(ConfirmProceedingAndProceduralActExistRequest.class));
}
}
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.DriversInspectionOfficeDto;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.request.CreateDriversInspectionRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
@RestController
@RequestMapping("drivers-inspections")
@RequiredArgsConstructor
public class DriversInspectionController extends TeisBaseController {
private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.drivers-inspections.drivers-inspection.create}", response = DriversInspectionOfficeDto.class)
@PostMapping
public DriversInspectionOfficeDto create(@RequestBody CreateDriversInspectionDto dto,
RequestMetaDTO requestMetaDTO) {
CreateDriversInspectionRequest request = new CreateDriversInspectionRequest();
request.setPayload(dto, requestMetaDTO);
return (DriversInspectionOfficeDto) service.sendAndReceive(request);
}
}
package ee.sm.ti.teis.officegateway.proceedings.proceduralact.controller;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.CreateDriversInspectionDto;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.dto.ProceedingAndProceduralActExistDto;
import ee.sm.ti.teis.officegateway.proceedings.proceduralact.request.ConfirmProceedingAndProceduralActExistRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Profile;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("procedural-acts/test")
@Profile({"dev", "test", "local", "integtest"})
@RequiredArgsConstructor
public class ProceduralActTestController extends TeisBaseController {
private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.proceeding.test.confirm-proceeding-and-procedural-act}", response = ProceedingAndProceduralActExistDto.class)
@GetMapping("exist")
public ProceedingAndProceduralActExistDto confirmExist(CreateDriversInspectionDto dto,
RequestMetaDTO requestMetaDTO) {
ConfirmProceedingAndProceduralActExistRequest request = new ConfirmProceedingAndProceduralActExistRequest();
request.setPayload(dto, requestMetaDTO);
return (ProceedingAndProceduralActExistDto) service.sendAndReceive(request);
}
}
...@@ -58,6 +58,8 @@ teis.api.proceeding.patch-procedural-act: API-ga muudetakse kontrolli staatust. ...@@ -58,6 +58,8 @@ teis.api.proceeding.patch-procedural-act: API-ga muudetakse kontrolli staatust.
teis.api.proceeding.delete-procedural-act: APIga on võimalik kustutada kontrolli objekti ja sellega seotud objektide andmeid. Mõeldud kontrolli kustutamiseks. teis.api.proceeding.delete-procedural-act: APIga on võimalik kustutada kontrolli objekti ja sellega seotud objektide andmeid. Mõeldud kontrolli kustutamiseks.
teis.api.proceeding.procedural-act-feedback: API väljastab csv faili, milles on sisendis esitatud perioodil lõppenud menetluste kontrollide tagasiside adresaatite nimi ja e-posti aadress ning kontrolli läbiviinud TI teenistujate nimed. teis.api.proceeding.procedural-act-feedback: API väljastab csv faili, milles on sisendis esitatud perioodil lõppenud menetluste kontrollide tagasiside adresaatite nimi ja e-posti aadress ning kontrolli läbiviinud TI teenistujate nimed.
teis.api.proceeding.test.confirm-proceeding-and-procedural-act: Testteenus tagastab kehtivamenetluse ja kehtiva kontrolli eksisteerimise kinnituse.
teis.api.proceeding.get-procedural-act-inspection-topics: API-ga on võimalik otsida kontrollile lisatud kontrolli teemasid. teis.api.proceeding.get-procedural-act-inspection-topics: API-ga on võimalik otsida kontrollile lisatud kontrolli teemasid.
teis.api.proceeding.put-procedural-act-inspection-topics: API-ga on võimalik muuta kontrollil kontrolliteemasid. teis.api.proceeding.put-procedural-act-inspection-topics: API-ga on võimalik muuta kontrollil kontrolliteemasid.
teis.api.proceeding.patch-procedural-act-inspection-topic-outcome: API-ga on võimalik muuta kontrolliga seotud kontrolliteemat kontrollituks või mittekontrollituks või ebaoluliseks. teis.api.proceeding.patch-procedural-act-inspection-topic-outcome: API-ga on võimalik muuta kontrolliga seotud kontrolliteemat kontrollituks või mittekontrollituks või ebaoluliseks.
...@@ -192,3 +194,5 @@ teis.api.risk-assessments.risk-factor-details.delete: Teenus kustutab ohu täpsu ...@@ -192,3 +194,5 @@ teis.api.risk-assessments.risk-factor-details.delete: Teenus kustutab ohu täpsu
teis.api.risk-assessments.risk-indicator.create: Teenus salvestab uue mõõdetava näitaja seadistuse. teis.api.risk-assessments.risk-indicator.create: Teenus salvestab uue mõõdetava näitaja seadistuse.
teis.api.risk-assessments.risk-indicator.update: Teenus salvestab mõõdetava näitaja seadistuse muudatused. teis.api.risk-assessments.risk-indicator.update: Teenus salvestab mõõdetava näitaja seadistuse muudatused.
teis.api.risk-assessments.risk-indicator.delete: Teenus kustutab mõõdetava näitaja andmed. teis.api.risk-assessments.risk-indicator.delete: Teenus kustutab mõõdetava näitaja andmed.
teis.api.drivers-inspections.drivers-inspection.create: Teenus loob sõidukijuhtide tööaja nõuete täitmise kontrolli protsessi andmeobjekti.
theGroup=ee.sm.ti.teis theGroup=ee.sm.ti.teis
theVersion=1.25.0 theVersion=1.26.0-SNAPSHOT
commonsVersion=1.25.0 commonsVersion=1.26.0-SNAPSHOT
commonApiGatewayVersion=1.25.0 commonApiGatewayVersion=1.26.0-SNAPSHOT
pluginVersion=1.3.0 pluginVersion=1.3.0
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