using SIGCM2.Application.Abstractions; using SIGCM2.Application.Abstractions.Persistence; using SIGCM2.Application.IngresosBrutos.Dtos; using SIGCM2.Domain.Exceptions; namespace SIGCM2.Application.IngresosBrutos.GetById; public sealed class GetIngresosBrutosByIdQueryHandler : ICommandHandler { private readonly IIngresosBrutosRepository _repo; public GetIngresosBrutosByIdQueryHandler(IIngresosBrutosRepository repo) { _repo = repo; } public async Task Handle(GetIngresosBrutosByIdQuery query) { var entity = await _repo.GetByIdAsync(query.Id) ?? throw new IngresosBrutosNotFoundException(query.Id); return IngresosBrutosMapper.ToDto(entity); } }