mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* 11291 initial optimize graphql queries * 11291 add optimizer to schemas * 11291 cleanup fields.py * 11291 fix fragment query
21 lines
632 B
Python
21 lines
632 B
Python
import graphene
|
|
|
|
from django.contrib.auth.models import Group, User
|
|
from netbox.graphql.fields import ObjectField, ObjectListField
|
|
from .types import *
|
|
from utilities.graphql_optimizer import gql_query_optimizer
|
|
|
|
|
|
class UsersQuery(graphene.ObjectType):
|
|
group = ObjectField(GroupType)
|
|
group_list = ObjectListField(GroupType)
|
|
|
|
def resolve_group_list(root, info, **kwargs):
|
|
return gql_query_optimizer(Group.objects.all(), info)
|
|
|
|
user = ObjectField(UserType)
|
|
user_list = ObjectListField(UserType)
|
|
|
|
def resolve_user_list(root, info, **kwargs):
|
|
return gql_query_optimizer(User.objects.all(), info)
|