Commit 7e285981 authored by Jürgen Hannus's avatar Jürgen Hannus
Browse files

Merge branch 'TEIS-1981' into 'develop'

TEIS-1981: functionality to map S3 Minio bucket dynamically (configuration...

See merge request teis/office-api-gateway!162
parents a42db830 e722aaed
......@@ -6,7 +6,9 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
public class GenerateDocumentRequest extends AbstractDTO<GenerateDocumentRequest.Parameters, ErrorDTO> {
import static ee.sm.ti.teis.officegateway.docgen.request.GenerateDocumentRequest.Parameters;
public class GenerateDocumentRequest extends AbstractDTO<Parameters, ErrorDTO> {
public static final String ROUTING_KEY = "api.GenerateDocumentRequest";
......@@ -19,9 +21,11 @@ public class GenerateDocumentRequest extends AbstractDTO<GenerateDocumentRequest
@AllArgsConstructor
@NoArgsConstructor
public static class Parameters {
private String templateId;
private String fileName;
private String jsonData;
private String outputFormat;
private String objectType;
}
}
......@@ -22,6 +22,6 @@ class DocGenTestControllerTest extends OfficeApiGatewayTestBase {
@Test
void generate_badRequest() {
assertThrows(NoResponseFromRabbitException.class, () ->
controller.generate("", "", "", "", new RequestMetaDTO()));
controller.generate("", "", "", "", "", new RequestMetaDTO()));
}
}
......@@ -13,6 +13,9 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import static ee.sm.ti.teis.types.enums.classifier.ObjectType.PROCEEDING;
import static org.springframework.util.StringUtils.hasText;
@Profile({"dev", "test", "local", "integtest"})
@RestController
@RequestMapping("templates")
......@@ -35,9 +38,12 @@ public class DocGenTestController extends TeisBaseController {
@ApiOperation(value = "${teis.api.docgen.generate}")
@PostMapping("generate")
public FileMetadataDto generate(@RequestParam String templateId, @RequestParam(required = false) String fileName,
@RequestParam(required = false) String outputFormat, @RequestBody String templateData, RequestMetaDTO requestMetaDTO) {
@RequestParam(required = false) String outputFormat, @RequestBody String templateData,
@RequestParam(required = false) String objectType, RequestMetaDTO requestMetaDTO) {
GenerateDocumentRequest request = new GenerateDocumentRequest();
request.setPayload(new GenerateDocumentRequest.Parameters(templateId, fileName, templateData, outputFormat), requestMetaDTO);
objectType = hasText(objectType) ? objectType : PROCEEDING.getId();
request.setPayload(new GenerateDocumentRequest.Parameters(templateId, fileName, templateData, outputFormat,
objectType), requestMetaDTO);
return (FileMetadataDto) requestProcessingService.sendAndReceive(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