Skip to content

Commit

Permalink
HRIS-335 [BE] Implement fetching of filed schedules on a specific user (
Browse files Browse the repository at this point in the history
  • Loading branch information
NiloJr-sun committed Jul 7, 2023
1 parent 30576e0 commit 652e93f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api/Schema/Queries/EmployeeScheduleQuery.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using api.DTOs;
using api.Entities;
using api.Middlewares.Attributes;
using api.Requests;
using api.Services;
Expand Down Expand Up @@ -29,6 +30,11 @@ public async Task<List<UserDTO>> GetEmployeesBySchedule(int employeeScheduleId)
return await _employeeScheduleService.GetEmployeesBySchedule(employeeScheduleId);
}

public async Task<List<ChangeScheduleRequest>?> GetEmployeeChangeScheduleRequest(int userId)
{
return await _employeeScheduleService.GetEmployeeChangeScheduleRequest(userId);
}

[AdminUser]
public async Task<List<UserDTO>> SearchEmployeesBySchedule(SearchEmployeesByScheduleRequest request)
{
Expand Down
6 changes: 6 additions & 0 deletions api/Services/EmployeeScheduleService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public async Task<List<EmployeeScheduleDTO>> GetEmployeeScheduleDetails(int empl
.ToListAsync();
}

public async Task<List<ChangeScheduleRequest>?> GetEmployeeChangeScheduleRequest(int userId)
{
using HrisContext context = _contextFactory.CreateDbContext();
return await context.ChangeScheduleRequests.Where(x => x.UserId == userId).ToListAsync();
}

public async Task<string> Create(CreateEmployeeScheduleRequest request, HrisContext context)
{
// validate inputs
Expand Down

0 comments on commit 652e93f

Please sign in to comment.