I have a very simple IQueryable in my Query class for GraphQL. What I am wanting to accomplish is to get the Authorized User that is requesting the chat information. Change context.Chats to context.Chats.Where(i => i.UserId == RequestingId). So you can't obtain private chats from my API. If you aren't authorized then you will always receive a empty list. I have seen how to do this with a MVC controller but that isn't the desired result.
public class Query
{
[UseDbContext(typeof(AppDbContext))]
[UseFiltering]
[UseSorting]
public IQueryable<Chat> GetChats([ScopedService] AppDbContext context)
{
return context.Chats
.Include(m => m.Messages)
.Include(r => r.Recipients);
}
}