เพิ่มworkflow

This commit is contained in:
kittapath 2024-10-17 12:28:15 +07:00
parent 617176f1b0
commit f8f63e312f
2 changed files with 34 additions and 18 deletions

View file

@ -17,6 +17,7 @@ using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
using System.Net.Http.Headers;
namespace BMA.EHR.Leave.Service.Controllers
{
@ -333,6 +334,21 @@ 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 });
}