namespace Brizco.Repository.Handlers.ShiftPlans; public class GetShiftPlanQueryHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; public GetShiftPlanQueryHandler(IRepositoryWrapper repositoryWrapper) { _repositoryWrapper = repositoryWrapper; } public async Task Handle(GetShiftPlanQuery request, CancellationToken cancellationToken) { var shiftPlan = await _repositoryWrapper.SetRepository() .TableNoTracking .Where(s => s.Id == request.Id) .Select(ShiftPlanMapper.ProjectToLDto) .FirstOrDefaultAsync(cancellationToken); if (shiftPlan == null) throw new AppException("ShiftPlan not found", ApiResultStatusCode.NotFound); return shiftPlan; } }