partido + melhorias
All checks were successful
API and ETL Build / build_etl (push) Successful in 17s
API and ETL Build / build_api (push) Successful in 9s

This commit is contained in:
2025-05-31 20:46:48 -03:00
parent 146495c07b
commit a3d67198af
14 changed files with 137 additions and 74 deletions

View File

@@ -58,6 +58,17 @@ namespace OpenCand.Repository
}
}
public async Task<Partido?> GetPartidoBySigla(string sigla)
{
using (var connection = new NpgsqlConnection(ConnectionString))
{
var query = @"
SELECT * FROM partido
WHERE sigla = @sigla";
return await connection.QueryFirstOrDefaultAsync<Partido>(query, new { sigla });
}
}
public async Task<List<RedeSocial>?> GetCandidatoRedeSocialById(Guid idcandidato)
{
using (var connection = new NpgsqlConnection(ConnectionString))

View File

@@ -21,7 +21,7 @@ namespace OpenCand.API.Repository
(SELECT COUNT(*) FROM bem_candidato) AS TotalBemCandidatos,
(SELECT SUM(valor) FROM bem_candidato) AS TotalValorBemCandidatos,
(SELECT COUNT(*) FROM rede_social) AS TotalRedesSociais,
(SELECT COUNT(DISTINCT ano) FROM bem_candidato) AS TotalEleicoes;");
(SELECT COUNT(DISTINCT ano) FROM candidato_mapping) AS TotalEleicoes;");
return stats ?? new OpenCandStats();
}
}