This commit is contained in:
parent
e55001e234
commit
3880ce6985
3 changed files with 18 additions and 3 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue