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