Add auth and response docs to DocumentController endpoints

This commit is contained in:
JavMB 2026-05-14 20:48:35 +02:00
parent a37cb64a19
commit e58b6c0679
1 changed files with 5 additions and 0 deletions

View File

@ -1,4 +1,5 @@
using DoliMiddlewareApi.Services; using DoliMiddlewareApi.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
@ -6,10 +7,14 @@ namespace DoliMiddlewareApi.Controllers
{ {
[Route("api/[controller]")] [Route("api/[controller]")]
[ApiController] [ApiController]
[Authorize]
public class DocumentController(DocumentService documentService) : ControllerBase public class DocumentController(DocumentService documentService) : ControllerBase
{ {
[HttpGet("invoice/{invoiceRef}/pdf")] [HttpGet("invoice/{invoiceRef}/pdf")]
[ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
public async Task<IActionResult> GetInvoicePdf(string invoiceRef) public async Task<IActionResult> GetInvoicePdf(string invoiceRef)
{ {
var (content, filename) = await documentService.BuildInvoicePdfAsync(invoiceRef); var (content, filename) = await documentService.BuildInvoicePdfAsync(invoiceRef);