Enhance LeaveProcessJobStatusRepository with detailed processing logic and add new methods in UserProfileRepository for fetching officer and employee profiles by RootDnaId

This commit is contained in:
Suphonchai Phoonsawat 2026-03-30 15:53:33 +07:00
parent 3dee5f7166
commit 759a51ab58
3 changed files with 345 additions and 9 deletions

View file

@ -764,6 +764,75 @@ namespace BMA.EHR.Application.Repositories
}
}
public async Task<List<GetProfileByKeycloakIdRootDto>> GetAllOfficerByRootDnaId(string? rootDnaId, DateTime date)
{
try
{
var apiPath = $"{_configuration["API"]}/org/unauthorize/officer-list";
var apiKey = _configuration["API_KEY"];
var body = new
{
reqNode = 0,
reqNodeId = rootDnaId,
date = date
};
//Console.WriteLine(body);
var profiles = new List<SearchProfileDto>();
var apiResult = await PostExternalAPIAsync(apiPath, "", body, apiKey);
if (apiResult != null)
{
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
if (raw != null)
return raw.Result;
else
return new List<GetProfileByKeycloakIdRootDto>();
}
else
return new List<GetProfileByKeycloakIdRootDto>();
}
catch
{
throw;
}
}
public async Task<List<GetProfileByKeycloakIdRootDto>> GetAllEmployeeByRootDnaId(string? rootDnaId, DateTime date)
{
try
{
var apiPath = $"{_configuration["API"]}/org/unauthorize/employee-list";
var apiKey = _configuration["API_KEY"];
var body = new
{
reqNode = 0,
reqNodeId = rootDnaId,
startDate = date,
endDate = date
};
//Console.WriteLine(body);
var profiles = new List<SearchProfileDto>();
var apiResult = await PostExternalAPIAsync(apiPath, "", body, apiKey);
if (apiResult != null)
{
var raw = JsonConvert.DeserializeObject<GetListProfileByKeycloakIdRootResultDto>(apiResult);
if (raw != null)
return raw.Result;
else
return new List<GetProfileByKeycloakIdRootDto>();
}
else
return new List<GetProfileByKeycloakIdRootDto>();
}
catch
{
throw;
}
}
public async Task<List<GetProfileByKeycloakIdRootDto>> GetProfileByAdminRolev4(string? accessToken, int? node, string? nodeId, string role, string? revisionId, int? reqNode, string? reqNodeId, DateTime? startDate, DateTime? endDate)
{
try