Add DocResultController for envelope PDF download

Introduced DocResultController with a GET endpoint to retrieve envelope PDF documents by sending a query via MediatR. The controller returns the PDF as a file response with an appropriate filename and content type. Added necessary using directives for MediatR, ASP.NET Core MVC, and the application query.
This commit is contained in:
2026-04-09 10:30:04 +02:00
parent 2d8375f26a
commit 65c72bcf77

View File

@@ -0,0 +1,15 @@
using EnvelopeGenerator.Application.Envelopes.Queries;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.ServiceHost.Controllers;
[Route("api/[controller]")]
[ApiController]
public class DocResultController(IMediator mediator) : ControllerBase
{
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");
}
}