diff --git a/phronCare.API/Controllers/Stock/ExpeditionController.cs b/phronCare.API/Controllers/Stock/ExpeditionController.cs index 8367e22..342aa31 100644 --- a/phronCare.API/Controllers/Stock/ExpeditionController.cs +++ b/phronCare.API/Controllers/Stock/ExpeditionController.cs @@ -60,6 +60,29 @@ namespace phronCare.API.Controllers.Stock } } + // GET /api/expedition/{id} + [HttpGet("{id:int}")] + [ProducesResponseType(typeof(ExpeditionDto), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task> GetById(int id) + { + var dto = await _expeditionService.GetDtoByIdAsync(id); + if (dto is null) return NotFound($"Expedición con ID {id} no encontrada."); + return Ok(dto); + } + + // (opcional) GET /api/expedition/summary/{expeditionNumber} + [HttpGet("summary/{expeditionNumber}")] + [ProducesResponseType(typeof(ExpeditionDto), StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + public async Task> GetByNumber(string expeditionNumber) + { + var dto = await _expeditionService.GetDtoByExpeditionNumberAsync(expeditionNumber); + if (dto is null) return NotFound($"No se encontró expedición {expeditionNumber}."); + return Ok(dto); + } + + #region Endpoint de emision de expedicion (encabezado + detalles) [HttpPost("createfull")] public async Task CreateFullExpedition([FromBody] CreateFullExpeditionRequest request) @@ -108,7 +131,6 @@ namespace phronCare.API.Controllers.Stock return File(pdfBytes, "application/pdf", $"Expedicion_{expedition.Expeditionnumber}.pdf"); } - } public class CreateFullExpeditionRequest { diff --git a/phronCare.API/obj/Debug/net8.0/ApiEndpoints.json b/phronCare.API/obj/Debug/net8.0/ApiEndpoints.json index 47e7f6f..1e2d005 100644 --- a/phronCare.API/obj/Debug/net8.0/ApiEndpoints.json +++ b/phronCare.API/obj/Debug/net8.0/ApiEndpoints.json @@ -627,6 +627,41 @@ } ] }, + { + "ContainingType": "phronCare.API.Controllers.Stock.ExpeditionController", + "Method": "GetById", + "RelativePath": "api/Expedition/{id}", + "HttpMethod": "GET", + "IsController": true, + "Order": 0, + "Parameters": [ + { + "Name": "id", + "Type": "System.Int32", + "IsRequired": true + } + ], + "ReturnTypes": [ + { + "Type": "Domain.Dtos.Stock.ExpeditionDto", + "MediaTypes": [ + "text/plain", + "application/json", + "text/json" + ], + "StatusCode": 200 + }, + { + "Type": "Microsoft.AspNetCore.Mvc.ProblemDetails", + "MediaTypes": [ + "text/plain", + "application/json", + "text/json" + ], + "StatusCode": 404 + } + ] + }, { "ContainingType": "phronCare.API.Controllers.Stock.ExpeditionController", "Method": "GetQuotePdf", @@ -715,6 +750,41 @@ } ] }, + { + "ContainingType": "phronCare.API.Controllers.Stock.ExpeditionController", + "Method": "GetByNumber", + "RelativePath": "api/Expedition/summary/{expeditionNumber}", + "HttpMethod": "GET", + "IsController": true, + "Order": 0, + "Parameters": [ + { + "Name": "expeditionNumber", + "Type": "System.String", + "IsRequired": true + } + ], + "ReturnTypes": [ + { + "Type": "Domain.Dtos.Stock.ExpeditionDto", + "MediaTypes": [ + "text/plain", + "application/json", + "text/json" + ], + "StatusCode": 200 + }, + { + "Type": "Microsoft.AspNetCore.Mvc.ProblemDetails", + "MediaTypes": [ + "text/plain", + "application/json", + "text/json" + ], + "StatusCode": 404 + } + ] + }, { "ContainingType": "phronCare.API.Controllers.Sales.InstitutionController", "Method": "GetById", diff --git a/phronCare.UIBlazor/Services/Stock/Expeditions/ExpeditionService.cs b/phronCare.UIBlazor/Services/Stock/Expeditions/ExpeditionService.cs index 9746655..73ef64b 100644 --- a/phronCare.UIBlazor/Services/Stock/Expeditions/ExpeditionService.cs +++ b/phronCare.UIBlazor/Services/Stock/Expeditions/ExpeditionService.cs @@ -111,7 +111,7 @@ namespace phronCare.UIBlazor.Services.Stock.Expeditions { try { - var dto = await _http.GetFromJsonAsync($"/expedition/{id}"); + var dto = await _http.GetFromJsonAsync($"/api/expedition/{id}"); return dto; } catch (Exception ex)