Commit 19b5007b authored by Kristel Meikas's avatar Kristel Meikas
Browse files

TEIS-2186: added API endpoint for getting drivers' inspection object by procedural act

parent 15e855df
package ee.sm.ti.teis.officegateway.driversinspections.driversinspection.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import java.util.UUID;
public class DriversInspectionByProceduralActRequest extends AbstractDTO<UUID, ErrorDTO> {
public static final String ROUTING_KEY = "api.DriversInspectionByProceduralActRequest";
@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 DriversInspectionByProceduralActResponse extends AbstractDTO<DriversInspectionOfficeDto, ErrorDTO> {
public static final String ROUTING_KEY = "api.DriversInspectionByProceduralActResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
...@@ -6,11 +6,13 @@ import ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase; ...@@ -6,11 +6,13 @@ 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.CreateDriversInspectionDto;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.DriversInspectionOfficeDto; 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.officegateway.driversinspections.driversinspection.request.CreateDriversInspectionRequest;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.request.DriversInspectionByProceduralActRequest;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.test.context.support.WithMockUser; import org.springframework.security.test.context.support.WithMockUser;
import static ee.sm.ti.teis.officegateway.OfficeApiGatewayTestBase.MOCK_ROLE; 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.ArgumentMatchers.any;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
...@@ -34,4 +36,16 @@ public class DriversInspectionControllerTest extends OfficeApiGatewayTestBase { ...@@ -34,4 +36,16 @@ public class DriversInspectionControllerTest extends OfficeApiGatewayTestBase {
verify(requestProcessingService).sendAndReceive(any(CreateDriversInspectionRequest.class)); verify(requestProcessingService).sendAndReceive(any(CreateDriversInspectionRequest.class));
} }
@Test
void getByProceduralAct_success() {
when(requestProcessingService.sendAndReceive(any(DriversInspectionByProceduralActRequest.class)))
.thenReturn(new DriversInspectionOfficeDto());
parameters.add("proceduralActId", randomUUID().toString());
mockMvcUtil.testGet(BASE_URL, parameters, new TypeReference<DriversInspectionOfficeDto>() {
});
verify(requestProcessingService).sendAndReceive(any(DriversInspectionByProceduralActRequest.class));
}
} }
...@@ -5,13 +5,13 @@ import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService; ...@@ -5,13 +5,13 @@ 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.CreateDriversInspectionDto;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.dto.DriversInspectionOfficeDto; 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.officegateway.driversinspections.driversinspection.request.CreateDriversInspectionRequest;
import ee.sm.ti.teis.officegateway.driversinspections.driversinspection.request.DriversInspectionByProceduralActRequest;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO; import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.UUID;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("drivers-inspections") @RequestMapping("drivers-inspections")
...@@ -30,4 +30,14 @@ public class DriversInspectionController extends TeisBaseController { ...@@ -30,4 +30,14 @@ public class DriversInspectionController extends TeisBaseController {
return (DriversInspectionOfficeDto) service.sendAndReceive(request); return (DriversInspectionOfficeDto) service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.drivers-inspections.drivers-inspections.get-by-procedural-act}", response = DriversInspectionOfficeDto.class)
@GetMapping
public DriversInspectionOfficeDto getByProceduralAct(@RequestParam UUID proceduralActId,
RequestMetaDTO requestMetaDTO) {
DriversInspectionByProceduralActRequest request = new DriversInspectionByProceduralActRequest();
request.setPayload(proceduralActId, requestMetaDTO);
return (DriversInspectionOfficeDto) service.sendAndReceive(request);
}
} }
...@@ -196,3 +196,4 @@ teis.api.risk-assessments.risk-indicator.update: Teenus salvestab mõõdetava n ...@@ -196,3 +196,4 @@ teis.api.risk-assessments.risk-indicator.update: Teenus salvestab mõõdetava n
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. teis.api.drivers-inspections.drivers-inspection.create: Teenus loob sõidukijuhtide tööaja nõuete täitmise kontrolli protsessi andmeobjekti.
teis.api.drivers-inspections.drivers-inspections.get-by-procedural-act: Teenus võimaldab kontrollida, kas järelvalve menetluses toimuva kontrolli kohta on olemas sõidukijuhtide tööaja nõuete täitmise kontrolli andmeobjekt.
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