diff --git a/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs b/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs index c1ecac6..9a3f656 100644 --- a/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs +++ b/src/ReC.Application/RecActions/Queries/ReadRecActionQuery.cs @@ -12,6 +12,8 @@ public record ReadRecActionQueryBase { public long ProfileId { get; init; } + public bool? Invoked { get; set; } = null; + public ReadRecActionQuery ToReadQuery() => new(this); } @@ -26,7 +28,12 @@ public class ReadRecActionQueryHandler(IRepository repo, IMapper { public async Task> Handle(ReadRecActionQuery request, CancellationToken cancel) { - var actions = await repo.Where(act => act.ProfileId == request.ProfileId).Where(act => act.Root!.OutRes != null).ToListAsync(cancel); + var query = repo.Where(act => act.ProfileId == request.ProfileId); + + if (request.Invoked is bool invoked) + query = invoked ? query.Where(act => act.Root!.OutRes != null) : query.Where(act => act.Root!.OutRes == null); + + var actions = await query.ToListAsync(cancel); if(actions.Count == 0) throw new NotFoundException($"No actions found for the profile {request.ProfileId}.");