แก้ api ลา
This commit is contained in:
parent
d08b4ca723
commit
4822110533
20 changed files with 20695 additions and 2783 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -136,6 +136,28 @@ namespace BMA.EHR.Application.Repositories
|
|||
var apiPath = $"{_configuration["API"]}/org/dotnet/keycloak/{keycloakId}";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<GetProfileByKeycloakIdDto?> GetProfileByProfileIdAsync(Guid keycloakId, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/dotnet/profile/{keycloakId}";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
|
||||
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult != null)
|
||||
|
|
@ -146,15 +168,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
|
||||
return null;
|
||||
|
||||
//var data = await _dbContext.Set<Profile>().AsQueryable()
|
||||
// .Include(p => p.Prefix)
|
||||
// .Include(p => p.Position)
|
||||
// .Include(p => p.PositionLevel)
|
||||
// .Include(p => p.Salaries)
|
||||
// .FirstOrDefaultAsync(p => p.KeycloakId == keycloakId);
|
||||
|
||||
//return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -532,7 +545,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public GetProfileByIdDto GetOfficerProfileByCitizenId(string citizenId, string? accessToken)
|
||||
public async Task<GetProfileByKeycloakIdDto?> GetOfficerProfileByCitizenId(string citizenId, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -542,7 +555,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
|
||||
if (apiResult.Result != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByIdResultDto>(apiResult.Result);
|
||||
var raw = JsonConvert.DeserializeObject<GetProfileByKeycloakIdResultDto>(apiResult.Result);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue