เพิ่ม workflow

This commit is contained in:
kittapath 2024-10-18 09:48:08 +07:00
parent f8f63e312f
commit a583dc7c42
2 changed files with 35 additions and 16 deletions

View file

@ -334,21 +334,6 @@ namespace BMA.EHR.Leave.Service.Controllers
// save to database
await _leaveRequestRepository.AddAsync(leaveRequest);
var baseAPIOrg = _configuration["API"];
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/add-workflow";
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 = leaveRequest.Id,
sysName = "LEAVE_LIST",
posLevelName = profile.PosLevel,
posTypeName = profile.PosType,
});
}
return Success(new { id = leaveRequest.Id });
}
@ -1462,6 +1447,28 @@ 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";
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 = "LEAVE_LIST",
posLevelName = profile.PosLevel?.PosLevelName ?? "",
posTypeName = profile.PosType?.PosTypeName ?? "",
});
Console.WriteLine(_res);
}
return Success();
}