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:
2025-12-12 10:46:20 +01:00
parent a5aac1d0ec
commit fd7744e94e

View File

@@ -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);