I have below queries in my graphene API list,
class Query(UserQuery, graphene.ObjectType):
all_users = DjangoFilterConnectionField(
UserType, filterset_class=UserFilter)
all_leagues = DjangoFilterConnectionField(
LeagueType, filterset_class=LeagueFilter)
For these connections fields I need to apply @login_required style permission.
I found that I need to resolve these api endpoints in order to apply those.
@login_required
def resolve_all_users(self, info):
#code
But I don't know what to return from the above method? There is a model called Users and ideally all records from that model needs to be returned.
But when I apply filter on first, last, before, after, I get below error,
"message": "Query.resolve_all_users() got an unexpected keyword argument 'first'"
Please advise.
Below code shows how to resolve the DjangoFilterConnectionField and it is similar to any other Django query resolve method.