mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
9856 Replace graphene with Strawberry (#15141)
* 9856 base strawberry integration * 9856 user and group * 9856 user and circuits base * 9856 extras and mixins * 9856 fk * 9856 update strawberry version * 9856 update imports * 9856 compatability fixes * 9856 compatability fixes * 9856 update strawberry types * 9856 update strawberry types * 9856 core schema * 9856 dcim schema * 9856 extras schema * 9856 ipam and tenant schema * 9856 virtualization, vpn, wireless schema * 9856 fix old decorator * 9856 cleanup * 9856 cleanup * 9856 fixes to circuits type specifiers * 9856 fixes to circuits type specifiers * 9856 update types * 9856 GFK working * 9856 GFK working * 9856 _name * 9856 misc fixes * 9856 type updates * 9856 _name to types * 9856 update types * 9856 update types * 9856 update types * 9856 update types * 9856 update types * 9856 update types * 9856 update types * 9856 update types * 9856 update types * 9856 GraphQLView * 9856 GraphQLView * 9856 fix OrganizationalObjectType * 9856 single item query for schema * 9856 circuits graphql tests working * 9856 test fixes * 9856 test fixes * 9856 test fixes * 9856 test fix vpn * 9856 test fixes * 9856 test fixes * 9856 test fixes * 9856 circuits test sans DjangoModelType * 9856 core test sans DjangoModelType * 9856 temp checkin * 9856 fix extas FK * 9856 fix tenancy FK * 9856 fix virtualization FK * 9856 fix vpn FK * 9856 fix wireless FK * 9856 fix ipam FK * 9856 fix partial dcim FK * 9856 fix dcim FK * 9856 fix virtualization FK * 9856 fix tests / remove debug code * 9856 fix test imagefield * 9856 cleanup graphene * 9856 fix plugin schema * 9856 fix requirements * 9856 fix requirements * 9856 fix docs * 9856 fix docs * 9856 temp fix tests * 9856 first filterset * 9856 first filterset * 9856 fix tests * 9856 fix tests * 9856 working auto filter generation * 9856 filter types * 9856 filter types * 9856 filter types * 9856 fix graphiql test * 9856 fix counter fields and merge feature * 9856 temp fix tests * 9856 fix tests * 9856 fix tenancy, ipam filter definitions * 9856 cleanup * 9856 cleanup * 9856 cleanup * 9856 review changes * 9856 review changes * 9856 review changes * 9856 fix base-requirements * 9856 add wrapper to graphiql * 9856 remove old graphiql debug toolbar * 9856 review changes * 9856 update strawberry * 9856 remove superfluous check --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -1,44 +1,40 @@
|
||||
import graphene
|
||||
from typing import List
|
||||
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
|
||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
||||
from tenancy import models
|
||||
from .types import *
|
||||
from utilities.graphql_optimizer import gql_query_optimizer
|
||||
|
||||
|
||||
class TenancyQuery(graphene.ObjectType):
|
||||
tenant = ObjectField(TenantType)
|
||||
tenant_list = ObjectListField(TenantType)
|
||||
@strawberry.type
|
||||
class TenancyQuery:
|
||||
@strawberry.field
|
||||
def tenant(self, id: int) -> TenantType:
|
||||
return models.Tenant.objects.get(pk=id)
|
||||
tenant_list: List[TenantType] = strawberry_django.field()
|
||||
|
||||
def resolve_tenant_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.Tenant.objects.all(), info)
|
||||
@strawberry.field
|
||||
def tenant_group(self, id: int) -> TenantGroupType:
|
||||
return models.TenantGroup.objects.get(pk=id)
|
||||
tenant_group_list: List[TenantGroupType] = strawberry_django.field()
|
||||
|
||||
tenant_group = ObjectField(TenantGroupType)
|
||||
tenant_group_list = ObjectListField(TenantGroupType)
|
||||
@strawberry.field
|
||||
def contact(self, id: int) -> ContactType:
|
||||
return models.Contact.objects.get(pk=id)
|
||||
contact_list: List[ContactType] = strawberry_django.field()
|
||||
|
||||
def resolve_tenant_group_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.TenantGroup.objects.all(), info)
|
||||
@strawberry.field
|
||||
def contact_role(self, id: int) -> ContactRoleType:
|
||||
return models.ContactRole.objects.get(pk=id)
|
||||
contact_role_list: List[ContactRoleType] = strawberry_django.field()
|
||||
|
||||
contact = ObjectField(ContactType)
|
||||
contact_list = ObjectListField(ContactType)
|
||||
@strawberry.field
|
||||
def contact_group(self, id: int) -> ContactGroupType:
|
||||
return models.ContactGroup.objects.get(pk=id)
|
||||
contact_group_list: List[ContactGroupType] = strawberry_django.field()
|
||||
|
||||
def resolve_contact_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.Contact.objects.all(), info)
|
||||
|
||||
contact_role = ObjectField(ContactRoleType)
|
||||
contact_role_list = ObjectListField(ContactRoleType)
|
||||
|
||||
def resolve_contact_role_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.ContactRole.objects.all(), info)
|
||||
|
||||
contact_group = ObjectField(ContactGroupType)
|
||||
contact_group_list = ObjectListField(ContactGroupType)
|
||||
|
||||
def resolve_contact_group_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.ContactGroup.objects.all(), info)
|
||||
|
||||
contact_assignment = ObjectField(ContactAssignmentType)
|
||||
contact_assignment_list = ObjectListField(ContactAssignmentType)
|
||||
|
||||
def resolve_contact_assignment_list(root, info, **kwargs):
|
||||
return gql_query_optimizer(models.ContactAssignment.objects.all(), info)
|
||||
@strawberry.field
|
||||
def contact_assignment(self, id: int) -> ContactAssignmentType:
|
||||
return models.ContactAssignment.objects.get(pk=id)
|
||||
contact_assignment_list: List[ContactAssignmentType] = strawberry_django.field()
|
||||
|
Reference in New Issue
Block a user