Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 38s

This commit is contained in:
harid 2025-12-17 16:11:45 +07:00
commit 2187d9f3e6

View file

@ -160,6 +160,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Core
var token = context.Request.Headers["Authorization"];
var pf = await GetProfileByKeycloakIdAsync(Guid.Parse(keycloakId), token);
var _userFullname = string.Empty;
var _userName = string.Empty;
if (keycloakId != "00000000-0000-0000-0000-000000000000" && pf == null)
{
_userFullname = context.User?.FindFirst("name")?.Value;
_userName = context.User?.FindFirst("preferred_username")?.Value;
}
await _next(context); // ดำเนินการต่อไปยัง Middleware อื่น ๆ
@ -260,8 +267,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Core
output = responseBodyJson,
userId = keycloakId,
userName = $"{pf?.Prefix ?? ""}{pf?.FirstName ?? ""} {pf?.LastName ?? ""}",
user = pf?.CitizenId ?? ""
userName = pf != null ? $"{pf?.Prefix ?? ""}{pf?.FirstName ?? ""} {pf?.LastName ?? ""}" : _userFullname ?? "",
user = pf != null ? pf?.CitizenId ?? "" : _userName ?? ""
};