mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Rename sequences & indexes after renaming users table * Migrate from auth.Group to a custom group model * Delete original groups from auth_group table * Update object & multi-object custom fields referencing the Group model * Fix ContentType resolution * Clean up obsolete logic for view/serializer resolution
22 lines
671 B
Python
22 lines
671 B
Python
import graphene
|
|
from django.contrib.auth import get_user_model
|
|
|
|
from netbox.graphql.fields import ObjectField, ObjectListField
|
|
from users.models import Group
|
|
from utilities.graphql_optimizer import gql_query_optimizer
|
|
from .types import *
|
|
|
|
|
|
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(get_user_model().objects.all(), info)
|