fix #1509
Some checks failed
release-dev / release-dev (push) Failing after 11s

This commit is contained in:
Suphonchai Phoonsawat 2025-05-07 12:36:23 +07:00
parent e55001e234
commit 3880ce6985
3 changed files with 18 additions and 3 deletions

View file

@ -253,10 +253,22 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
}
public async Task<List<LeaveRequest>> GetLeaveRequestByYearAsync(int year)
public async Task<List<LeaveRequest>> GetLeaveRequestByYearAsync(int year, Guid userId)
{
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, AccessToken);
if (profile == null)
{
throw new Exception("ไม่พบข้อมูลผู้ใช้งานในระบบทะเบียนประวัติ!!");
}
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
.Include(x => x.Type)
.Where(x => x.RootId == profile.RootId &&
x.Child1Id == profile.Child1Id &&
x.Child2Id == profile.Child2Id &&
x.Child3Id == profile.Child3Id &&
x.Child4Id == profile.Child4Id)
.Where(x => x.LeaveStartDate.Year == year)
.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
.ToListAsync();