feat(adm-009): TipoDeIva + IngresosBrutos handlers, DTOs, DI registration
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
namespace SIGCM2.Application.IngresosBrutos.GetById;
|
||||
|
||||
public sealed record GetIngresosBrutosByIdQuery(int Id);
|
||||
@@ -0,0 +1,25 @@
|
||||
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<GetIngresosBrutosByIdQuery, IngresosBrutosDto>
|
||||
{
|
||||
private readonly IIngresosBrutosRepository _repo;
|
||||
|
||||
public GetIngresosBrutosByIdQueryHandler(IIngresosBrutosRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task<IngresosBrutosDto> Handle(GetIngresosBrutosByIdQuery query)
|
||||
{
|
||||
var entity = await _repo.GetByIdAsync(query.Id)
|
||||
?? throw new IngresosBrutosNotFoundException(query.Id);
|
||||
|
||||
return IngresosBrutosMapper.ToDto(entity);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user