Add GetOcByNodeId method to UserProfileRepository and update InsigniaManageController to use it #2389

This commit is contained in:
Suphonchai Phoonsawat 2026-04-02 11:00:14 +07:00
parent ea694bfda2
commit 69b89dfc90
2 changed files with 40 additions and 1 deletions

View file

@ -1259,6 +1259,38 @@ namespace BMA.EHR.Application.Repositories
}
}
public GetOrganizationResponseDTO? GetOcByNodeId(Guid ocId, int level, string? accessToken)
{
try
{
var apiPath = $"{_configuration["API"]}/org/find/all";
var apiKey = _configuration["API_KEY"];
var body = new
{
nodeId = ocId,
node = level
};
var apiResult = PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey).Result;
if (apiResult != null)
{
var raw = JsonConvert.DeserializeObject<GetOrganizationResponseResultDTO>(apiResult);
if (raw != null && raw.Result != null)
{
return raw.Result;
}
}
return null;
}
catch
{
throw;
}
}
public GetOrganizationResponseDTO? GetOc(Guid ocId, int level, string? accessToken)
{
try