Refactor user profile retrieval to use new method GetProfileByKeycloakIdNewAsync
This commit is contained in:
parent
2b737de23b
commit
5b64018ba5
1 changed files with 13 additions and 13 deletions
|
|
@ -433,7 +433,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
var data = await _userTimeStampRepository.GetLastRecord(userId);
|
var data = await _userTimeStampRepository.GetLastRecord(userId);
|
||||||
|
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
@ -896,7 +896,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
await _checkInJobStatusRepository.UpdateToProcessingAsync(taskId);
|
await _checkInJobStatusRepository.UpdateToProcessingAsync(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, data.Token);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, data.Token);
|
||||||
|
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -1206,7 +1206,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> CheckInOldAsync([FromForm] CheckTimeDto data)
|
public async Task<ActionResult<ResponseObject>> CheckInOldAsync([FromForm] CheckTimeDto data)
|
||||||
{
|
{
|
||||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
|
||||||
|
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -1371,7 +1371,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||||
|
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -1660,7 +1660,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(d.KeycloakUserId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(d.KeycloakUserId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -2543,7 +2543,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
var time = DateTime.Now;
|
var time = DateTime.Now;
|
||||||
|
|
||||||
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
@ -2663,7 +2663,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
var userId = UserId != null ? Guid.Parse(UserId) : Guid.Empty;
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(userId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
throw new Exception(GlobalMessages.DataNotFound);
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
@ -2826,7 +2826,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
foreach (var data in rawDataPaged)
|
foreach (var data in rawDataPaged)
|
||||||
{
|
{
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(data.KeycloakUserId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(data.KeycloakUserId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -3006,7 +3006,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
// change user timestamp
|
// change user timestamp
|
||||||
var processTimeStamp = await _processUserTimeStampRepository.GetTimestampByDateAsync(requestData.KeycloakUserId, requestData.CheckDate.Date);
|
var processTimeStamp = await _processUserTimeStampRepository.GetTimestampByDateAsync(requestData.KeycloakUserId, requestData.CheckDate.Date);
|
||||||
|
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(requestData.KeycloakUserId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(requestData.KeycloakUserId, AccessToken);
|
||||||
|
|
||||||
if (processTimeStamp == null)
|
if (processTimeStamp == null)
|
||||||
{
|
{
|
||||||
|
|
@ -3160,7 +3160,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
requestData.Comment = req.Reason;
|
requestData.Comment = req.Reason;
|
||||||
await _additionalCheckRequestRepository.UpdateAsync(requestData);
|
await _additionalCheckRequestRepository.UpdateAsync(requestData);
|
||||||
|
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(requestData.KeycloakUserId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(requestData.KeycloakUserId, AccessToken);
|
||||||
|
|
||||||
var recvId = new List<Guid> { profile.Id };
|
var recvId = new List<Guid> { profile.Id };
|
||||||
await _notificationRepository.PushNotificationsAsync(recvId.ToArray(), "ลงเวลากรณีพิเศษ", "การขอลงเวลากรณีพิเศษของคุณไม่ได้รับการอนุมัติ", "", "", true, false);
|
await _notificationRepository.PushNotificationsAsync(recvId.ToArray(), "ลงเวลากรณีพิเศษ", "การขอลงเวลากรณีพิเศษของคุณไม่ได้รับการอนุมัติ", "", "", true, false);
|
||||||
|
|
@ -3204,7 +3204,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(d.KeycloakUserId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(d.KeycloakUserId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -3298,7 +3298,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
foreach (var data in rawData)
|
foreach (var data in rawData)
|
||||||
{
|
{
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(data.KeycloakUserId, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(data.KeycloakUserId, AccessToken);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
{
|
{
|
||||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||||
|
|
@ -3611,7 +3611,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public async Task<ActionResult<ResponseObject>> GetLeaveSummaryByProfileAsync(Guid id, [FromBody] GetLeaveSummaryDto req)
|
public async Task<ActionResult<ResponseObject>> GetLeaveSummaryByProfileAsync(Guid id, [FromBody] GetLeaveSummaryDto req)
|
||||||
{
|
{
|
||||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(id, AccessToken);
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdNewAsync(id, AccessToken);
|
||||||
|
|
||||||
var thisYear = DateTime.Now.Year;
|
var thisYear = DateTime.Now.Year;
|
||||||
var startDate = req.StartDate;
|
var startDate = req.StartDate;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue