Commit 425beb1c authored by Kristel Meikas's avatar Kristel Meikas
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Kristel Meikas

See merge request teis/common-api-gateway!199
parents 705744ec c3294cc5
package ee.sm.ti.teis.commongateway.violationact;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.commongateway.proceedings.violationact.ViolationActController;
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;
class ViolationActControllerTest extends CommonApiGatewayTestBase {
@Autowired
ViolationActController controller;
@Test
void getViolations_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.getViolationActs(randomUUID(), randomUUID(), new RequestMetaDTO()));
}
@Test
void getViolation_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.getViolationAct(randomUUID(), new RequestMetaDTO()));
}
}
package ee.sm.ti.teis.commongateway.admin; package ee.sm.ti.teis.commongateway.admin;
import ee.sm.ti.teis.commongateway.file.FileReferenceDto; import ee.sm.ti.teis.commongateway.file.FileReferenceDto;
import ee.sm.ti.teis.commongateway.messages.message.MessageProcessingService;
import ee.sm.ti.teis.commongateway.messages.message.dto.MessageFileReferenceDto; import ee.sm.ti.teis.commongateway.messages.message.dto.MessageFileReferenceDto;
import ee.sm.ti.teis.commongateway.messages.message.request.CreateMessageFileReferencesRequest; import ee.sm.ti.teis.commongateway.messages.message.request.CreateMessageFileReferencesRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
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;
...@@ -20,8 +20,7 @@ import java.util.UUID; ...@@ -20,8 +20,7 @@ import java.util.UUID;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AdminForTestingController extends TeisBaseController { public class AdminForTestingController extends TeisBaseController {
private final AdminForTestingProcessingService service; private final RequestProcessingService service;
private final MessageProcessingService messageProcessingService;
@ApiOperation(value = "${teis.api.admin.reset-message-email}") @ApiOperation(value = "${teis.api.admin.reset-message-email}")
@GetMapping("reset-message-email/{messageId}") @GetMapping("reset-message-email/{messageId}")
...@@ -29,7 +28,7 @@ public class AdminForTestingController extends TeisBaseController { ...@@ -29,7 +28,7 @@ public class AdminForTestingController extends TeisBaseController {
ResetMessageEmailRequest request = new ResetMessageEmailRequest(); ResetMessageEmailRequest request = new ResetMessageEmailRequest();
request.setPayload(messageId, requestMetaDTO); request.setPayload(messageId, requestMetaDTO);
return service.resetMessageEmail(request); return (UUID) service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.messages.message.post-message-file-references}", response = FileReferenceDto.class) @ApiOperation(value = "${teis.api.messages.message.post-message-file-references}", response = FileReferenceDto.class)
...@@ -40,7 +39,7 @@ public class AdminForTestingController extends TeisBaseController { ...@@ -40,7 +39,7 @@ public class AdminForTestingController extends TeisBaseController {
dtoList.forEach(reference -> reference.setObjectId(id)); dtoList.forEach(reference -> reference.setObjectId(id));
request.setPayload(dtoList, requestMetaDTO); request.setPayload(dtoList, requestMetaDTO);
return messageProcessingService.createFileReferences(request); return (List<FileReferenceDto>) service.sendAndReceive(request);
} }
} }
package ee.sm.ti.teis.commongateway.admin;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import java.util.UUID;
@Service
@Deprecated(since = "1.19.0", forRemoval = true)
public class AdminForTestingProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public AdminForTestingProcessingService(RabbitTemplate gwRabbitTemplate) {
this.gwRabbitTemplate = gwRabbitTemplate;
}
UUID resetMessageEmail(ResetMessageEmailRequest request) {
ResetMessageEmailResponse response = (ResetMessageEmailResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.admin; package ee.sm.ti.teis.commongateway.admin;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
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;
...@@ -16,15 +17,15 @@ import java.time.LocalDateTime; ...@@ -16,15 +17,15 @@ import java.time.LocalDateTime;
@RequiredArgsConstructor @RequiredArgsConstructor
public class DeadlineController extends TeisBaseController { public class DeadlineController extends TeisBaseController {
private final DeadlineProcessingService deadlineProcessingService; private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.messages.deadline.get}", response = LocalDateTime.class) @ApiOperation(value = "${teis.api.messages.deadline.get}", response = LocalDateTime.class)
@GetMapping(value = "deadline", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "deadline", produces = MediaType.APPLICATION_JSON_VALUE)
public LocalDateTime getDeadline(GetDeadlineDto getDeadlineDto, RequestMetaDTO requestMetaDTO) { public LocalDateTime getDeadline(GetDeadlineDto getDeadlineDto, RequestMetaDTO requestMetaDTO) {
CalculateDeadlineGwRequest request = new CalculateDeadlineGwRequest(); CalculateDeadlineGwRequest request = new CalculateDeadlineGwRequest();
request.setPayload(getDeadlineDto, requestMetaDTO); request.setPayload(getDeadlineDto, requestMetaDTO);
return deadlineProcessingService.getDeadline(request); return (LocalDateTime) service.sendAndReceive(request);
} }
} }
package ee.sm.ti.teis.commongateway.admin;
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.time.LocalDateTime;
@Service
@Deprecated(since = "1.19.0", forRemoval = true)
@RequiredArgsConstructor
public class DeadlineProcessingService {
private final RabbitTemplate gwRabbitTemplate;
LocalDateTime getDeadline(CalculateDeadlineGwRequest requestDTO) {
CalculateDeadlineGwResponse resultDTO = (CalculateDeadlineGwResponse) gwRabbitTemplate
.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (resultDTO != null) {
return resultDTO.processResponse();
}
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.admin; package ee.sm.ti.teis.commongateway.admin;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
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;
...@@ -15,15 +16,14 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -15,15 +16,14 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor @RequiredArgsConstructor
public class FeatureFlagController extends TeisBaseController { public class FeatureFlagController extends TeisBaseController {
private final FeatureFlagProcessingService service; private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.admin.get-feature-flags}", response = FeatureFlagDto.class) @ApiOperation(value = "${teis.api.admin.get-feature-flags}", response = FeatureFlagDto.class)
@GetMapping("{id}") @GetMapping("{id}")
public FeatureFlagDto getFeatureFlag(@PathVariable("id") String id, RequestMetaDTO requestMetaDTO) { public FeatureFlagDto getFeatureFlag(@PathVariable("id") String id, RequestMetaDTO requestMetaDTO) {
FeatureFlagRequest request = new FeatureFlagRequest(); FeatureFlagRequest request = new FeatureFlagRequest();
request.setPayload(id, requestMetaDTO); request.setPayload(id, requestMetaDTO);
return service.getFeatureFlag(request); return (FeatureFlagDto) service.sendAndReceive(request);
} }
} }
package ee.sm.ti.teis.commongateway.admin;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
@Service
@Deprecated(since = "1.19.0", forRemoval = true)
@RequiredArgsConstructor
public class FeatureFlagProcessingService {
private final RabbitTemplate gwRabbitTemplate;
public FeatureFlagDto getFeatureFlag(FeatureFlagRequest request) {
FeatureFlagResponse response =
(FeatureFlagResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
...@@ -4,7 +4,6 @@ import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; ...@@ -4,7 +4,6 @@ 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;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -19,10 +18,11 @@ public class PathController extends TeisBaseController { ...@@ -19,10 +18,11 @@ public class PathController extends TeisBaseController {
private final PathProcessingService service; private final PathProcessingService service;
@ApiOperation(value = "${teis.api.path.get}") @ApiOperation(value = "${teis.api.path.get}")
@GetMapping(value = "path", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping("path")
public Map<String,String> getPath(PathDto path, RequestMetaDTO requestMetaDTO) { public Map<String,String> getPath(PathDto path, RequestMetaDTO requestMetaDTO) {
GetPathRequest request = new GetPathRequest(); GetPathRequest request = new GetPathRequest();
request.setPayload(path, requestMetaDTO); request.setPayload(path, requestMetaDTO);
return Map.of("path", service.getPath(request)); return Map.of("path", service.getPath(request));
} }
......
...@@ -5,7 +5,6 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate; ...@@ -5,7 +5,6 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
@Deprecated(since = "1.19.0", forRemoval = true)
public class PathProcessingService { public class PathProcessingService {
private final RabbitTemplate gwRabbitTemplate; private final RabbitTemplate gwRabbitTemplate;
...@@ -16,9 +15,11 @@ public class PathProcessingService { ...@@ -16,9 +15,11 @@ public class PathProcessingService {
String getPath(GetPathRequest requestDTO) { String getPath(GetPathRequest requestDTO) {
GetPathResponse resultDTO = (GetPathResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO); GetPathResponse resultDTO = (GetPathResponse) gwRabbitTemplate.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (resultDTO != null) { if (resultDTO != null) {
return resultDTO.processResponse(); return resultDTO.processResponse();
} }
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId()); throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
} }
......
...@@ -2,6 +2,7 @@ package ee.sm.ti.teis.commongateway.classifier; ...@@ -2,6 +2,7 @@ package ee.sm.ti.teis.commongateway.classifier;
import ee.sm.ti.teis.commongateway.classifier.search.ClassifierItemSearchFilterDto; import ee.sm.ti.teis.commongateway.classifier.search.ClassifierItemSearchFilterDto;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO; import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.types.enums.classifier.LinkedItems; import ee.sm.ti.teis.types.enums.classifier.LinkedItems;
import ee.sm.ti.teis.types.enums.classifier.RelationType; import ee.sm.ti.teis.types.enums.classifier.RelationType;
...@@ -17,15 +18,15 @@ import java.util.List; ...@@ -17,15 +18,15 @@ import java.util.List;
@RequiredArgsConstructor @RequiredArgsConstructor
public class ClassifierController extends TeisBaseController { public class ClassifierController extends TeisBaseController {
private final ClassifierProcessingService classifierProcessingService; private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.messages.get-classifier-items}", response = String.class) @ApiOperation(value = "${teis.api.messages.get-classifier-items}", response = String.class)
@GetMapping(value = "classifier-items", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "classifier-items", produces = MediaType.APPLICATION_JSON_VALUE)
public List<ClassifierItemDto> getClassifiers(ClassifierItemSearchFilterDto searchFilterDto, RequestMetaDTO requestMetaDTO) { public List<ClassifierItemDto> getClassifiers(ClassifierItemSearchFilterDto searchFilterDto, RequestMetaDTO requestMetaDTO) {
ClassifierItemsRequest request = new ClassifierItemsRequest(); ClassifierItemsRequest request = new ClassifierItemsRequest();
request.setPayload(new ClassifierItemsRequest.Parameters(searchFilterDto), requestMetaDTO); request.setPayload(new ClassifierItemsRequest.Parameters(searchFilterDto), requestMetaDTO);
return classifierProcessingService.getClassifiers(request); return (List<ClassifierItemDto>) service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.messages.get-classifier}", response = String.class) @ApiOperation(value = "${teis.api.messages.get-classifier}", response = String.class)
...@@ -34,20 +35,21 @@ public class ClassifierController extends TeisBaseController { ...@@ -34,20 +35,21 @@ public class ClassifierController extends TeisBaseController {
@PathVariable(name = "id") String id, @PathVariable(name = "id") String id,
@RequestParam(value = "linkedItems", required = false) LinkedItems linkedItems, @RequestParam(value = "linkedItems", required = false) LinkedItems linkedItems,
@RequestParam(name = "relations", required = false) RelationType relations, @RequestParam(name = "relations", required = false) RelationType relations,
RequestMetaDTO requestMetaDTO) { RequestMetaDTO requestMetaDTO) {
ClassifierItemRequest request = new ClassifierItemRequest(); ClassifierItemRequest request = new ClassifierItemRequest();
request.setPayload(new ClassifierItemRequest.Parameters(id, linkedItems, relations), requestMetaDTO); request.setPayload(new ClassifierItemRequest.Parameters(id, linkedItems, relations), requestMetaDTO);
return classifierProcessingService.getClassifier(request);
return (ClassifierItemDto) service.sendAndReceive(request);
} }
@ApiOperation(value = "${teis.api.messages.get-classifier-default-value}") @ApiOperation(value = "${teis.api.messages.get-classifier-default-value}")
@GetMapping(value = "classifier-definitions/{definitionId}/default-value", produces = MediaType.APPLICATION_JSON_VALUE) @GetMapping(value = "classifier-definitions/{definitionId}/default-value", produces = MediaType.APPLICATION_JSON_VALUE)
public ClassifierItemDto getDefinition( public ClassifierItemDto getDefinition(
@PathVariable(name = "definitionId") String definitionId, RequestMetaDTO requestMetaDTO) { @PathVariable(name = "definitionId") String definitionId, RequestMetaDTO requestMetaDTO) {
ClassifierDefinitionRequest request = new ClassifierDefinitionRequest(); ClassifierDefinitionRequest request = new ClassifierDefinitionRequest();
request.setPayload(new ClassifierDefinitionRequest.Parameters(definitionId), requestMetaDTO); request.setPayload(new ClassifierDefinitionRequest.Parameters(definitionId), requestMetaDTO);
return classifierProcessingService.getDefaultValue(request); return (ClassifierItemDto) service.sendAndReceive(request);
} }
} }
package ee.sm.ti.teis.commongateway.classifier;
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
@Deprecated(since = "1.19.0", forRemoval = true)
@RequiredArgsConstructor
public class ClassifierProcessingService {
private final RabbitTemplate gwRabbitTemplate;
List<ClassifierItemDto> getClassifiers(ClassifierItemsRequest requestDTO) {
ClassifierItemsResponse resultDTO = (ClassifierItemsResponse) gwRabbitTemplate
.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (resultDTO != null) {
return resultDTO.processResponse();
}
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
ClassifierItemDto getClassifier(ClassifierItemRequest requestDTO) {
ClassifierItemResponse resultDTO = (ClassifierItemResponse) gwRabbitTemplate
.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (resultDTO != null) {
return resultDTO.processResponse();
}
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
ClassifierItemDto getDefaultValue(ClassifierDefinitionRequest requestDTO) {
ClassifierDefinitionFieldResponse resultDTO = (ClassifierDefinitionFieldResponse) gwRabbitTemplate
.convertSendAndReceive(requestDTO.routingKey(), requestDTO);
if (resultDTO != null) {
return resultDTO.processResponse();
}
throw new NoResponseFromRabbitException(requestDTO.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.dumonitor;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
@Service
@Deprecated(since = "1.19.0", forRemoval = true)
@RequiredArgsConstructor
public class DUMonitorProcessingService {
private final RabbitTemplate gwRabbitTemplate;
String send(SendPersonalDataUsageRequest request) {
SendPersonalDataUsageResponse response = (SendPersonalDataUsageResponse) gwRabbitTemplate.convertSendAndReceive(request.routingKey(), request);
if (response != null) {
return response.processResponse();
}
throw new NoResponseFromRabbitException(request.getRequestMetaDTO().getRequestId());
}
}
package ee.sm.ti.teis.commongateway.dumonitor; package ee.sm.ti.teis.commongateway.dumonitor;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController; import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.gatewaycommon.rabbit.RequestProcessingService;
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;
...@@ -10,21 +11,21 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -10,21 +11,21 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/dumonitor") @RequestMapping("dumonitor")
@Profile({"dev", "test", "local", "integtest"}) @Profile({"dev", "test", "local", "integtest"})
@RequiredArgsConstructor @RequiredArgsConstructor
public class DUMonitorTestController extends TeisBaseController { public class DUMonitorTestController extends TeisBaseController {
private final DUMonitorProcessingService processingService; private final RequestProcessingService service;
@ApiOperation(value = "${teis.api.messages.post-usage-data}", response = String.class) @ApiOperation(value = "${teis.api.messages.post-usage-data}", response = String.class)
@PostMapping @PostMapping
public String send(@RequestBody PersonalDataUsageDto usageData, RequestMetaDTO requestMetaDTO) { public String send(@RequestBody PersonalDataUsageDto usageData, RequestMetaDTO requestMetaDTO) {
SendPersonalDataUsageRequest request = new SendPersonalDataUsageRequest(); SendPersonalDataUsageRequest request = new SendPersonalDataUsageRequest();
request.setPayload(new SendPersonalDataUsageRequest.Parameters(usageData), requestMetaDTO); request.setPayload(new SendPersonalDataUsageRequest.Parameters(usageData), requestMetaDTO);
return processingService.send(request);
return (String) service.sendAndReceive(request);
} }
} }
...@@ -2,8 +2,6 @@ package ee.sm.ti.teis.commongateway.file; ...@@ -2,8 +2,6 @@ package ee.sm.ti.teis.commongateway.file;
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.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -22,24 +20,19 @@ public class FileController extends TeisBaseController { ...@@ -22,24 +20,19 @@ public class FileController extends TeisBaseController {
private final FileProcessingService fileProcessingService; private final FileProcessingService fileProcessingService;
@ApiOperation(value = "${teis.api.messages.proceeding.post-file}") @ApiOperation(value = "${teis.api.messages.proceeding.post-file}")
@ApiImplicitParams(value = {
@ApiImplicitParam(dataType = "__file", name = "file", required = true, paramType = "form"),
@ApiImplicitParam(dataType = "string", name = "contextType", paramType = "form"),
@ApiImplicitParam(dataType = "string", name = "data", paramType = "form")
})
@PostMapping @PostMapping
public FileReferenceDto upload(@PathVariable("fileReferencePath") FileObjectType fileReferencePath, public FileReferenceDto upload(@PathVariable("fileReferencePath") FileObjectType fileReferencePath,
@PathVariable UUID id, HttpServletRequest request, @PathVariable UUID id, HttpServletRequest request,
RequestMetaDTO requestMetaDTO) throws Exception { RequestMetaDTO requestMetaDTO) throws Exception {
return fileContentService.saveFileToStorage(request, id, fileReferencePath, requestMetaDTO); return fileContentService.saveFileToStorage(request, id, fileReferencePath, requestMetaDTO);
} }