Add GetOCStaffAsync method to UserProfileRepository and create GetOcStaff response models
This commit is contained in:
parent
d3cc0781cf
commit
4f18a97d0b
3 changed files with 158 additions and 5 deletions
|
|
@ -186,6 +186,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<GetProfileByKeycloakIdDto?> GetProfileByKeycloakIdNewAsync(Guid keycloakId, string? accessToken,CancellationToken cancellationToken = default)
|
||||
{
|
||||
try
|
||||
|
|
@ -256,6 +258,36 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<GetOcStaff>?> GetOCStaffAsync(Guid profileId, string? accessToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
var apiPath = $"{_configuration["API"]}/org/dotnet/find-staff";
|
||||
var apiKey = _configuration["API_KEY"];
|
||||
var body = new
|
||||
{
|
||||
assignId = "SYS_LEAVE_LIST",
|
||||
profileId = profileId
|
||||
};
|
||||
|
||||
//var profiles = new List<GetOcStaff>();
|
||||
|
||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken ?? "", body, apiKey);
|
||||
if (apiResult != null)
|
||||
{
|
||||
var raw = JsonConvert.DeserializeObject<GetOcStaffResultDto>(apiResult);
|
||||
if (raw != null)
|
||||
return raw.Result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<GetProfileLeaveByKeycloakDto?> GetProfileLeaveReportByKeycloakIdAsync(Guid keycloakId, string? accessToken, string? report)
|
||||
{
|
||||
try
|
||||
|
|
@ -268,7 +300,7 @@ namespace BMA.EHR.Application.Repositories
|
|||
report = report
|
||||
};
|
||||
|
||||
var profiles = new List<SearchProfileDto>();
|
||||
//var profiles = new List<SearchProfileDto>();
|
||||
|
||||
var apiResult = await PostExternalAPIAsync(apiPath, accessToken, body, apiKey);
|
||||
if (apiResult != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue