Add GET endpoint to return envelope PDF by UUID

Added a new HTTP GET action to DocResultController that accepts a ReadSingleEnvelopeDocResultQuery via query string. The endpoint uses MediatR to retrieve the PDF document and returns it as a file response with the envelope's UUID in the filename and the correct content type.
This commit is contained in:
2026-04-09 14:05:54 +02:00
parent bcf4e63f7c
commit a72cbab195

View File

@@ -8,6 +8,7 @@ namespace EnvelopeGenerator.ServiceHost.Controllers;
[ApiController]
public class DocResultController(IMediator mediator) : ControllerBase
{
[HttpGet]
public async Task<IActionResult> GetAsync([FromQuery] ReadSingleEnvelopeDocResultQuery query, CancellationToken cancel = default)
{
return File(await mediator.Send(query, cancel), "application/pdf", $"envelope_{query.Envelope.Uuid}.pdf");