Add filtering for non-null OutRes in ReadRecActionQuery
Enhanced the `Handle` method in `ReadRecActionQueryHandler` to include an additional filtering condition when querying the repository. The query now filters actions where `RootAction.OutRes` is not null, in addition to matching the `ProfileId`. This ensures that only relevant actions with a valid `OutRes` are included in the result set.
This commit is contained in:
parent
b00902e461
commit
3b6df031a6
@ -26,7 +26,7 @@ public class ReadRecActionQueryHandler(IRepository<RecActionView> repo, IMapper
|
|||||||
{
|
{
|
||||||
public async Task<IEnumerable<RecActionDto>> Handle(ReadRecActionQuery request, CancellationToken cancel)
|
public async Task<IEnumerable<RecActionDto>> Handle(ReadRecActionQuery request, CancellationToken cancel)
|
||||||
{
|
{
|
||||||
var actions = await repo.Where(x => x.ProfileId == request.ProfileId).ToListAsync(cancel);
|
var actions = await repo.Where(act => act.ProfileId == request.ProfileId).Where(act => act.RootAction!.OutRes != null).ToListAsync(cancel);
|
||||||
|
|
||||||
if(actions.Count == 0)
|
if(actions.Count == 0)
|
||||||
throw new NotFoundException($"No actions found for the profile {request.ProfileId}.");
|
throw new NotFoundException($"No actions found for the profile {request.ProfileId}.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user