diff --git a/api/Schema/Queries/EmployeeScheduleQuery.cs b/api/Schema/Queries/EmployeeScheduleQuery.cs index f63fcc4c..00b31f31 100644 --- a/api/Schema/Queries/EmployeeScheduleQuery.cs +++ b/api/Schema/Queries/EmployeeScheduleQuery.cs @@ -1,4 +1,5 @@ using api.DTOs; +using api.Entities; using api.Middlewares.Attributes; using api.Requests; using api.Services; @@ -29,6 +30,11 @@ public async Task> GetEmployeesBySchedule(int employeeScheduleId) return await _employeeScheduleService.GetEmployeesBySchedule(employeeScheduleId); } + public async Task?> GetEmployeeChangeScheduleRequest(int userId) + { + return await _employeeScheduleService.GetEmployeeChangeScheduleRequest(userId); + } + [AdminUser] public async Task> SearchEmployeesBySchedule(SearchEmployeesByScheduleRequest request) { diff --git a/api/Services/EmployeeScheduleService.cs b/api/Services/EmployeeScheduleService.cs index 5feab5e7..c599a72f 100644 --- a/api/Services/EmployeeScheduleService.cs +++ b/api/Services/EmployeeScheduleService.cs @@ -46,6 +46,12 @@ public async Task> GetEmployeeScheduleDetails(int empl .ToListAsync(); } + public async Task?> GetEmployeeChangeScheduleRequest(int userId) + { + using HrisContext context = _contextFactory.CreateDbContext(); + return await context.ChangeScheduleRequests.Where(x => x.UserId == userId).ToListAsync(); + } + public async Task Create(CreateEmployeeScheduleRequest request, HrisContext context) { // validate inputs