Compare commits
No commits in common. "146495c07b06bbd161c17e62dccb30b6220448e1" and "2a7c42531aeea94bb0128efe0480f691ff348bec" have entirely different histories.
146495c07b
...
2a7c42531a
3
.gitignore
vendored
3
.gitignore
vendored
@ -12,7 +12,4 @@ sample*
|
||||
data
|
||||
appsettings.Development.json
|
||||
|
||||
fotos_cand
|
||||
*.zip
|
||||
|
||||
docker-compose.yaml
|
@ -1,5 +1,4 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.VisualBasic;
|
||||
using OpenCand.API.Model;
|
||||
using OpenCand.API.Services;
|
||||
using OpenCand.Core.Models;
|
||||
@ -38,14 +37,5 @@ namespace OpenCand.API.Controllers
|
||||
{
|
||||
return await openCandService.GetCandidatoRedeSocialById(id);
|
||||
}
|
||||
|
||||
[HttpGet("{id}/reveal-cpf")]
|
||||
public async Task<CpfRevealResult> GetCandidatoCpfById([FromRoute] Guid id)
|
||||
{
|
||||
var rnd = new Random();
|
||||
var randomWait = rnd.Next(1000, 3000);
|
||||
await Task.Delay(randomWait);
|
||||
return await openCandService.GetCandidatoCpfById(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,4 @@ namespace OpenCand.API.Model
|
||||
{
|
||||
public List<RedeSocial> RedesSociais { get; set; }
|
||||
}
|
||||
|
||||
public class CpfRevealResult
|
||||
{
|
||||
public string Cpf { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -25,10 +25,4 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="fotos_cand.zip" />
|
||||
<Content Remove="fotos_cand" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
|
@ -36,17 +36,6 @@ namespace OpenCand.Repository
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string?> GetCandidatoCpfAsync(Guid idcandidato)
|
||||
{
|
||||
using (var connection = new NpgsqlConnection(ConnectionString))
|
||||
{
|
||||
return await connection.QueryFirstOrDefaultAsync<string>(@"
|
||||
SELECT cpf FROM candidato
|
||||
WHERE idcandidato = @idcandidato;",
|
||||
new { idcandidato });
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<CandidatoMapping>?> GetCandidatoMappingById(Guid idcandidato)
|
||||
{
|
||||
using (var connection = new NpgsqlConnection(ConnectionString))
|
||||
|
@ -94,19 +94,5 @@ namespace OpenCand.API.Services
|
||||
RedesSociais = result.OrderByDescending(r => r.Ano).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<CpfRevealResult> GetCandidatoCpfById(Guid idcandidato)
|
||||
{
|
||||
var result = await candidatoRepository.GetCandidatoCpfAsync(idcandidato);
|
||||
if (result == null)
|
||||
{
|
||||
return new CpfRevealResult();
|
||||
}
|
||||
|
||||
return new CpfRevealResult()
|
||||
{
|
||||
Cpf = result
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user