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