no message

This commit is contained in:
Bright 2025-01-29 13:25:38 +07:00
parent 01f16eaef4
commit b785815170
2 changed files with 16 additions and 3 deletions

View file

@ -4,6 +4,10 @@ using BMA.EHR.Domain.Models.Retirement;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Security.Claims;
using System.Text;
namespace BMA.EHR.Application.Repositories namespace BMA.EHR.Application.Repositories
{ {
@ -24,6 +28,13 @@ namespace BMA.EHR.Application.Repositories
_configuration = configuration; _configuration = configuration;
} }
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
#endregion
//ปลดออก //ปลดออก
public async Task NotifyDischarge() public async Task NotifyDischarge()
{ {
@ -111,8 +122,8 @@ namespace BMA.EHR.Application.Repositories
.ToList(); .ToList();
//ข้าราชการ //ข้าราชการ
var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement"; //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
//var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement"; var apiUrl = $"http://localhost:13001/api/v1/org/unauthorize/retirement";
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));

View file

@ -14,6 +14,7 @@ using Newtonsoft.Json.Linq;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Security.Claims; using System.Security.Claims;
using System.Text;
namespace BMA.EHR.Retirement.Service.Controllers namespace BMA.EHR.Retirement.Service.Controllers
{ {
@ -2008,7 +2009,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
// .FirstOrDefaultAsync(); // .FirstOrDefaultAsync();
// var body = retirePeriodOfficer.RetirementProfiles // var body = retirePeriodOfficer.RetirementProfiles
// .Select(x => new { // .Select(x => new
// {
// profileId = x.profileId, // profileId = x.profileId,
// //lastUpdateUserId = UserId, // //lastUpdateUserId = UserId,
// //lastUpdateFullName = FullName, // //lastUpdateFullName = FullName,