Include EndpointAuth in RecActionView query results
Added .Include(act => act.EndpointAuth) to eagerly load the EndpointAuth navigation property when retrieving RecActionView entities. Also made a minor formatting adjustment to the check for empty action results.
This commit is contained in:
@@ -38,9 +38,9 @@ public class ReadRecActionQueryHandler(IRepository<RecActionView> repo, IMapper
|
||||
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);
|
||||
var actions = await query.Include(act => act.EndpointAuth).ToListAsync(cancel);
|
||||
|
||||
if(actions.Count == 0)
|
||||
if (actions.Count == 0)
|
||||
throw new NotFoundException($"No actions found for the profile {request.ProfileId}.");
|
||||
|
||||
return mapper.Map<IEnumerable<RecActionDto>>(actions);
|
||||
|
||||
Reference in New Issue
Block a user