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:
@@ -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,7 +41,10 @@ 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.IncludeAction)
|
if(request.BatchId is string batchId)
|
||||||
|
q = q.Where(rv => rv.BatchId == batchId);
|
||||||
|
|
||||||
|
if (request.IncludeAction)
|
||||||
q = q.Include(rv => rv.Action);
|
q = q.Include(rv => rv.Action);
|
||||||
|
|
||||||
if(request.IncludeProfile)
|
if(request.IncludeProfile)
|
||||||
|
|||||||
Reference in New Issue
Block a user