2026-04-15 14:49:41 +00:00
|
|
|
|
using DoliMiddlewareApi.Services;
|
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DoliMiddlewareApi.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
public class DocumentController(DocumentService documentService) : ControllerBase
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2026-04-16 07:41:46 +00:00
|
|
|
|
[HttpGet("invoice/{invoiceRef}/pdf")]
|
|
|
|
|
|
public async Task<IActionResult> GetInvoicePdf(string invoiceRef)
|
2026-04-15 14:49:41 +00:00
|
|
|
|
{
|
2026-04-16 07:41:46 +00:00
|
|
|
|
var (content, filename) = await documentService.BuildInvoicePdfAsync(invoiceRef);
|
2026-04-15 14:49:41 +00:00
|
|
|
|
|
2026-04-16 07:41:46 +00:00
|
|
|
|
return File(content, "application/pdf", filename);
|
2026-04-15 14:49:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|