From df7bebe0ba8091c54a451a00b9c6377a4ae3fdca Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Tue, 5 May 2026 21:23:46 +0700 Subject: [PATCH] =?UTF-8?q?api=20check-time=20=E0=B9=81=E0=B8=81=E0=B8=B0?= =?UTF-8?q?=20profileId=20=E0=B8=88=E0=B8=B2=E0=B8=81=20token=20=E0=B9=80?= =?UTF-8?q?=E0=B8=9E=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B9=84=E0=B8=A1=E0=B9=88?= =?UTF-8?q?=E0=B8=95=E0=B9=89=E0=B8=AD=E0=B8=87=E0=B9=84=E0=B8=9B=20call?= =?UTF-8?q?=20=E0=B9=80=E0=B8=AD=E0=B8=B2=E0=B8=88=E0=B8=B2=E0=B8=81=20org?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BMA.EHR.Leave/Controllers/LeaveController.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/BMA.EHR.Leave/Controllers/LeaveController.cs b/BMA.EHR.Leave/Controllers/LeaveController.cs index 91289743..83c205f8 100644 --- a/BMA.EHR.Leave/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveController.cs @@ -446,29 +446,30 @@ namespace BMA.EHR.Leave.Service.Controllers public async Task> CheckTimeAsync(CancellationToken cancellationToken = default) { var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); + var profileId = ProfileId ?? Guid.Empty; // Get user's last check-in record and profile in parallel var dataTask = _userTimeStampRepository.GetLastRecord(userId); - var profileTask = _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken); + //var profileTask = _userProfileRepository.GetProfileByKeycloakIdNew2Async(userId, AccessToken); var defaultRoundTask = _dutyTimeRepository.GetDefaultAsync(); - await Task.WhenAll(dataTask, profileTask, defaultRoundTask); + await Task.WhenAll(dataTask, defaultRoundTask); var data = await dataTask; - var profile = await profileTask; + //var profile = await profileTask; var getDefaultRound = await defaultRoundTask; - if (profile == null) - { - throw new Exception(GlobalMessages.DataNotFound); - } + // if (profile == null) + // { + // throw new Exception(GlobalMessages.DataNotFound); + // } if (getDefaultRound == null) { return Error("ไม่พบรอบลงเวลา Default", StatusCodes.Status404NotFound); } - var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(profile.Id); + var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(profileId); var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty; var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);