From 5a226bfceaaea5c85ee956e0cabd6b02322de68a Mon Sep 17 00:00:00 2001 From: TekH Date: Thu, 4 Dec 2025 11:54:38 +0100 Subject: [PATCH] Update query to return IEnumerable Reordered using directives in DtoMappingProfile.cs. Added AutoMapper mapping for OutRes to OutResDto. Modified ReadOutResQuery to return IEnumerable. Updated ReadOutResHandler to handle collection results: - Changed Handle method to return IEnumerable. - Updated mapper.Map to map to a collection of OutResDto. --- src/ReC.Application/Common/Dto/DtoMappingProfile.cs | 4 ++-- src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ReC.Application/Common/Dto/DtoMappingProfile.cs b/src/ReC.Application/Common/Dto/DtoMappingProfile.cs index 801346b..ddf6e99 100644 --- a/src/ReC.Application/Common/Dto/DtoMappingProfile.cs +++ b/src/ReC.Application/Common/Dto/DtoMappingProfile.cs @@ -1,5 +1,4 @@ -using AutoMapper; -using ReC.Domain.Entities; +using ReC.Domain.Entities; namespace ReC.Application.Common.Dto; @@ -8,5 +7,6 @@ public class DtoMappingProfile : AutoMapper.Profile public DtoMappingProfile() { CreateMap(); + CreateMap(); } } diff --git a/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs b/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs index 27506a7..aacc634 100644 --- a/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs +++ b/src/ReC.Application/OutResults/Queries/ReadOutResQuery.cs @@ -8,16 +8,16 @@ using ReC.Domain.Entities; namespace ReC.Application.OutResults.Queries; -public record ReadOutResQuery : IRequest +public record ReadOutResQuery : IRequest> { public long? ProfileId { get; init; } public long? ActionId { get; init; } } -public class ReadOutResHandler(IRepository repo, IMapper mapper) : IRequestHandler +public class ReadOutResHandler(IRepository repo, IMapper mapper) : IRequestHandler> { - public async Task Handle(ReadOutResQuery request, CancellationToken cancel) + public async Task> Handle(ReadOutResQuery request, CancellationToken cancel) { var q = repo.Query; @@ -32,6 +32,6 @@ public class ReadOutResHandler(IRepository repo, IMapper mapper) : IRequ if (resList.Count == 0) throw new NotFoundException(); - return mapper.Map(resList); + return mapper.Map>(resList); } } \ No newline at end of file