remove workflow integration from LeaveRequestController #2164

This commit is contained in:
Suphonchai Phoonsawat 2026-01-07 12:06:49 +07:00
parent 7caf1cc8d6
commit e8dfe976a2

View file

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