Retry Con Cambios Importantes.
This commit is contained in:
		| @@ -53,20 +53,30 @@ public class ElectoralApiService : IElectoralApiService | ||||
|         return response.IsSuccessStatusCode ? await response.Content.ReadFromJsonAsync<List<AgrupacionDto>>() : null; | ||||
|     } | ||||
|  | ||||
|     public async Task<ResultadosDto?> GetResultadosAsync(string authToken, string distritoId, string seccionId, string municipioId) | ||||
|     public async Task<ResultadosDto?> GetResultadosAsync(string authToken, string distritoId, string seccionId, string? municipioId, int categoriaId) | ||||
|     { | ||||
|         var client = _httpClientFactory.CreateClient("ElectoralApiClient"); | ||||
|         var requestUri = $"/api/resultados/getResultados?distritoId={distritoId}&seccionId={seccionId}&municipioId={municipioId}&categoriaId=5"; // OJO: La categoría está fija | ||||
|  | ||||
|         // Construimos la URL base | ||||
|         var requestUri = $"/api/resultados/getResultados?distritoId={distritoId}&seccionId={seccionId}&categoriaId={categoriaId}"; | ||||
|  | ||||
|         // Añadimos el municipioId a la URL SÓLO si no es nulo o vacío | ||||
|         if (!string.IsNullOrEmpty(municipioId)) | ||||
|         { | ||||
|             requestUri += $"&municipioId={municipioId}"; | ||||
|         } | ||||
|  | ||||
|         var request = new HttpRequestMessage(HttpMethod.Get, requestUri); | ||||
|         request.Headers.Add("Authorization", $"Bearer {authToken}"); | ||||
|         var response = await client.SendAsync(request); | ||||
|         return response.IsSuccessStatusCode ? await response.Content.ReadFromJsonAsync<ResultadosDto>() : null; | ||||
|     } | ||||
|  | ||||
|     public async Task<RepartoBancasDto?> GetBancasAsync(string authToken, string distritoId, string seccionId) | ||||
|     public async Task<RepartoBancasDto?> GetBancasAsync(string authToken, string distritoId, string seccionId, int categoriaId) | ||||
|     { | ||||
|         var client = _httpClientFactory.CreateClient("ElectoralApiClient"); | ||||
|         var requestUri = $"/api/resultados/getBancas?distritoId={distritoId}&seccionId={seccionId}&categoriaId=5"; // OJO: La categoría está fija | ||||
|         // Usamos la categoriaId recibida en lugar de una fija | ||||
|         var requestUri = $"/api/resultados/getBancas?distritoId={distritoId}&seccionId={seccionId}&categoriaId={categoriaId}"; | ||||
|         var request = new HttpRequestMessage(HttpMethod.Get, requestUri); | ||||
|         request.Headers.Add("Authorization", $"Bearer {authToken}"); | ||||
|         var response = await client.SendAsync(request); | ||||
| @@ -103,10 +113,11 @@ public class ElectoralApiService : IElectoralApiService | ||||
|         return response.IsSuccessStatusCode ? await response.Content.ReadFromJsonAsync<ResumenDto>() : null; | ||||
|     } | ||||
|  | ||||
|     public async Task<EstadoRecuentoGeneralDto?> GetEstadoRecuentoGeneralAsync(string authToken, string distritoId) | ||||
|     public async Task<EstadoRecuentoGeneralDto?> GetEstadoRecuentoGeneralAsync(string authToken, string distritoId, int categoriaId) | ||||
|     { | ||||
|         var client = _httpClientFactory.CreateClient("ElectoralApiClient"); | ||||
|         var requestUri = $"/api/estados/estadoRecuento?distritoId={distritoId}"; | ||||
|         // La URL ahora usa el parámetro 'categoriaId' que se recibe | ||||
|         var requestUri = $"/api/estados/estadoRecuento?distritoId={distritoId}&categoriaId={categoriaId}"; | ||||
|         var request = new HttpRequestMessage(HttpMethod.Get, requestUri); | ||||
|         request.Headers.Add("Authorization", $"Bearer {authToken}"); | ||||
|         var response = await client.SendAsync(request); | ||||
|   | ||||
| @@ -12,11 +12,11 @@ public interface IElectoralApiService | ||||
|     // Métodos para catálogos | ||||
|     Task<CatalogoDto?> GetCatalogoAmbitosAsync(string authToken, int categoriaId); | ||||
|     Task<List<AgrupacionDto>?> GetAgrupacionesAsync(string authToken, string distritoId, int categoriaId); | ||||
|     Task<ResultadosDto?> GetResultadosAsync(string authToken, string distritoId, string seccionId, string municipioId); | ||||
|     Task<RepartoBancasDto?> GetBancasAsync(string authToken, string distritoId, string seccionId); | ||||
|     Task<ResultadosDto?> GetResultadosAsync(string authToken, string distritoId, string seccionId, string? municipioId, int categoriaId); | ||||
|     Task<RepartoBancasDto?> GetBancasAsync(string authToken, string distritoId, string seccionId, int categoriaId); | ||||
|     Task<List<string[]>?> GetTelegramasTotalizadosAsync(string authToken, string distritoId, string seccionId); | ||||
|     Task<TelegramaFileDto?> GetTelegramaFileAsync(string authToken, string mesaId); | ||||
|     Task<ResumenDto?> GetResumenAsync(string authToken, string distritoId); | ||||
|     Task<EstadoRecuentoGeneralDto?> GetEstadoRecuentoGeneralAsync(string authToken, string distritoId); | ||||
|     Task<EstadoRecuentoGeneralDto?> GetEstadoRecuentoGeneralAsync(string authToken, string distritoId, int categoriaId); | ||||
|     Task<List<CategoriaDto>?> GetCategoriasAsync(string authToken); | ||||
| } | ||||
| @@ -13,7 +13,7 @@ using System.Reflection; | ||||
| [assembly: System.Reflection.AssemblyCompanyAttribute("Elecciones.Infrastructure")] | ||||
| [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] | ||||
| [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] | ||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+69ddf2b2d24d4968c618c6fd9f38c1143625cdcd")] | ||||
| [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+30f1e751b770bf730fc48b1baefb00f560694f35")] | ||||
| [assembly: System.Reflection.AssemblyProductAttribute("Elecciones.Infrastructure")] | ||||
| [assembly: System.Reflection.AssemblyTitleAttribute("Elecciones.Infrastructure")] | ||||
| [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user