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:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user