Merge branch 'develop'
Some checks failed
DockerHub Release - Leave Service / release-to-dockerhub (push) Failing after 11s

* develop:
  remove workflow integration from LeaveRequestController #2164
This commit is contained in:
Warunee Tamkoo 2026-01-09 11:05:53 +07:00
commit 9dfd5efafc

View file

@ -2247,46 +2247,47 @@ namespace BMA.EHR.Leave.Service.Controllers
{
await _leaveRequestRepository.SendToOfficerAsync(id);
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
if (profile == null)
{
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var baseAPIOrg = _configuration["API"];
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/add-workflow";
if (profile.ProfileType == "OFFICER")
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
refId = id,
sysName = "SYS_LEAVE_LIST",
posLevelName = profile.PosLevel ?? "",
posTypeName = profile.PosType ?? "",
fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}"
});
}
}
else
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
refId = id,
sysName = "SYS_LEAVE_LIST_EMP",
posLevelName = profile.PosLevel ?? "",
posTypeName = profile.PosType ?? "",
fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}"
});
}
}
// Remove Workflow Integration
// var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
// var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
// if (profile == null)
// {
// return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
// }
// var baseAPIOrg = _configuration["API"];
// var apiUrlOrg = $"{baseAPIOrg}/org/workflow/add-workflow";
// if (profile.ProfileType == "OFFICER")
// {
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
// {
// refId = id,
// sysName = "SYS_LEAVE_LIST",
// posLevelName = profile.PosLevel ?? "",
// posTypeName = profile.PosType ?? "",
// fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}"
// });
// }
// }
// else
// {
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
// var _res = await client.PostAsJsonAsync(apiUrlOrg, new
// {
// refId = id,
// sysName = "SYS_LEAVE_LIST_EMP",
// posLevelName = profile.PosLevel ?? "",
// posTypeName = profile.PosType ?? "",
// fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}"
// });
// }
// }
return Success();
}