From 9d871dccf9b5a7368e4957df1bd8befcd2575012 Mon Sep 17 00:00:00 2001 From: javiermengual Date: Mon, 29 Dec 2025 16:37:46 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20a=C3=B1adir=20controlador=20de=20factur?= =?UTF-8?q?as?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/InvoicesController.cs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 DoliMiddlewareApi/Controllers/InvoicesController.cs diff --git a/DoliMiddlewareApi/Controllers/InvoicesController.cs b/DoliMiddlewareApi/Controllers/InvoicesController.cs new file mode 100644 index 0000000..dabed58 --- /dev/null +++ b/DoliMiddlewareApi/Controllers/InvoicesController.cs @@ -0,0 +1,30 @@ +using DoliMiddlewareApi.Services; +using Microsoft.AspNetCore.Mvc; + +namespace DoliMiddlewareApi.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class InvoicesController : ControllerBase +{ + private readonly DolibarrApiClient _dolibarrClient; + + public InvoicesController(DolibarrApiClient dolibarrClient) + { + _dolibarrClient = dolibarrClient; + } + + [HttpGet] + public async Task GetInvoices() + { + var invoices = await _dolibarrClient.GetInvoicesAsync(); + return Ok(invoices); + } + + [HttpGet("{id:int}")] + public async Task GetInvoice(int id) + { + var invoice = await _dolibarrClient.GetInvoiceAsync(id); + return Ok(invoice); + } +}