Add GetLastLeaveRequestByTypeForUserAsync2 method and update LeaveReportController to use new method for fetching last leave request #2305
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m0s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m0s
This commit is contained in:
parent
d748308419
commit
65feb994ee
2 changed files with 18 additions and 2 deletions
|
|
@ -569,6 +569,22 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<LeaveRequest?> GetLastLeaveRequestByTypeForUserAsync2(Guid keycloakUserId, Guid leaveTypeId, DateTime beforeDate)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
//.Where(x => x.LeaveStartDate.Date < beforeDate.Date)
|
||||
.Where(x => x.CreatedAt < beforeDate)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
.Where(x => x.LeaveStatus == "APPROVE" || x.LeaveStatus == "DELETING")
|
||||
//.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||
.OrderByDescending(x => x.LeaveStartDate.Date)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<LeaveRequest>> GetCancelLeaveRequestForAdminAsync(int year, Guid type, string status, string role, string? nodeId, int? node)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsNoTracking()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue