Add BatchId filter to ReadResultViewQuery and handler

Added an optional BatchId property to ReadResultViewQuery to enable filtering by BatchId. Updated ReadResultViewQueryHandler to apply this filter when BatchId is provided. Also adjusted the order of IncludeAction logic for clarity.
This commit is contained in:
2026-04-16 10:20:57 +02:00
parent 38f91aae84
commit e45aeea2b9

View File

@@ -17,6 +17,8 @@ public record ReadResultViewQuery : IRequest<IEnumerable<ResultViewDto>>
public long? ProfileId { get; init; } = null; public long? ProfileId { get; init; } = null;
public string? BatchId { get; init; } = null;
public bool IncludeAction { get; init; } = true; public bool IncludeAction { get; init; } = true;
public bool IncludeProfile { get; init; } = false; public bool IncludeProfile { get; init; } = false;
@@ -39,6 +41,9 @@ public class ReadResultViewQueryHandler(IRepository<ResultView> repo, IMapper ma
if(request.ProfileId is long profileId) if(request.ProfileId is long profileId)
q = q.Where(rv => rv.ProfileId == profileId); q = q.Where(rv => rv.ProfileId == profileId);
if(request.BatchId is string batchId)
q = q.Where(rv => rv.BatchId == batchId);
if (request.IncludeAction) if (request.IncludeAction)
q = q.Include(rv => rv.Action); q = q.Include(rv => rv.Action);