9856 update strawberry types

This commit is contained in:
Arthur 2024-02-06 14:02:55 -08:00
parent 663af64ec1
commit fb4d63f8a2
6 changed files with 31 additions and 23 deletions

View File

@ -1,7 +1,7 @@
import strawberry
import strawberry_django
from circuits import filtersets, models
from circuits import models
from dcim.graphql.mixins import CabledObjectMixin
from extras.graphql.mixins import CustomFieldsMixin, TagsMixin, ContactsMixin
from netbox.graphql.types import ObjectType, OrganizationalObjectType, NetBoxObjectType

View File

@ -94,8 +94,8 @@ class ComponentTemplateObjectType(
filters=CableFilter
)
class CableType(NetBoxObjectType):
a_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
b_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
# a_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
# b_terminations = graphene.List('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
class Meta:
model = models.Cable
@ -121,7 +121,8 @@ class CableType(NetBoxObjectType):
filters=CableTerminationFilter
)
class CableTerminationType(NetBoxObjectType):
termination = graphene.Field('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
# termination = graphene.Field('dcim.graphql.gfk_mixins.CableTerminationTerminationType')
pass
@strawberry_django.type(
@ -206,7 +207,8 @@ class DeviceBayTemplateType(ComponentTemplateObjectType):
filters=InventoryItemTemplateFilter
)
class InventoryItemTemplateType(ComponentTemplateObjectType):
component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemTemplateComponentType')
# component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemTemplateComponentType')
pass
@strawberry_django.type(
@ -299,7 +301,8 @@ class InterfaceTemplateType(ComponentTemplateObjectType):
filters=InventoryItemFilter
)
class InventoryItemType(ComponentObjectType):
component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemComponentType')
# component = graphene.Field('dcim.graphql.gfk_mixins.InventoryItemComponentType')
pass
@strawberry_django.type(
@ -512,7 +515,8 @@ class RegionType(VLANGroupsMixin, ContactsMixin, OrganizationalObjectType):
filters=SiteFilter
)
class SiteType(VLANGroupsMixin, ImageAttachmentsMixin, ContactsMixin, NetBoxObjectType):
asn = graphene.Field(BigInt)
# asn = graphene.Field(BigInt)
pass
@strawberry_django.type(

View File

@ -28,8 +28,8 @@ __all__ = (
class IPAddressFamilyType(graphene.ObjectType):
value = graphene.Int()
label = graphene.String()
# value = graphene.Int()
# label = graphene.String()
def __init__(self, value):
self.value = value
@ -40,7 +40,7 @@ class BaseIPAddressFamilyType:
"""
Base type for models that need to expose their IPAddress family type.
"""
family = graphene.Field(IPAddressFamilyType)
# family = graphene.Field(IPAddressFamilyType)
def resolve_family(self, _):
# Note that self, is an instance of models.IPAddress
@ -54,7 +54,8 @@ class BaseIPAddressFamilyType:
filters=ProviderFilter
)
class ASNType(NetBoxObjectType):
asn = graphene.Field(BigInt)
# asn = graphene.Field(BigInt)
pass
@strawberry_django.type(
@ -92,7 +93,8 @@ class FHRPGroupType(NetBoxObjectType):
filters=FHRPGroupAssignmentFilter
)
class FHRPGroupAssignmentType(BaseObjectType):
interface = graphene.Field('ipam.graphql.gfk_mixins.FHRPGroupInterfaceType')
# interface = graphene.Field('ipam.graphql.gfk_mixins.FHRPGroupInterfaceType')
pass
@strawberry_django.type(
@ -101,7 +103,7 @@ class FHRPGroupAssignmentType(BaseObjectType):
filters=IPAddressFilter
)
class IPAddressType(NetBoxObjectType, BaseIPAddressFamilyType):
assigned_object = graphene.Field('ipam.graphql.gfk_mixins.IPAddressAssignmentType')
# assigned_object = graphene.Field('ipam.graphql.gfk_mixins.IPAddressAssignmentType')
def resolve_role(self, info):
return self.role or None
@ -187,7 +189,8 @@ class VLANType(NetBoxObjectType):
filters=VLANGroupFilter
)
class VLANGroupType(OrganizationalObjectType):
scope = graphene.Field('ipam.graphql.gfk_mixins.VLANGroupScopeType')
# scope = graphene.Field('ipam.graphql.gfk_mixins.VLANGroupScopeType')
pass
@strawberry_django.type(

View File

@ -11,7 +11,7 @@ from users.graphql.schema import UsersQuery
@strawberry.type
class Query(
UsersQuery,
# CircuitsQuery,
CircuitsQuery,
# CoreQuery,
# DCIMQuery,
# ExtrasQuery,

View File

@ -17,7 +17,7 @@ __all__ = (
class ContactAssignmentsMixin:
assignments = graphene.List('tenancy.graphql.types.ContactAssignmentType')
# assignments = graphene.List('tenancy.graphql.types.ContactAssignmentType')
def resolve_assignments(self, info):
return self.assignments.restrict(info.context.user, 'view')
@ -30,7 +30,7 @@ class ContactAssignmentsMixin:
@strawberry_django.type(
models.Tenant,
fields='__all__',
filters=TenantFilter
# filters=TenantFilter
)
class TenantType(NetBoxObjectType):
pass
@ -39,7 +39,7 @@ class TenantType(NetBoxObjectType):
@strawberry_django.type(
models.TenantGroup,
fields='__all__',
filters=TenantGroupFilter
# filters=TenantGroupFilter
)
class TenantGroupType(OrganizationalObjectType):
pass
@ -52,7 +52,7 @@ class TenantGroupType(OrganizationalObjectType):
@strawberry_django.type(
models.Contact,
fields='__all__',
filters=ContactFilter
# filters=ContactFilter
)
class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
pass
@ -61,7 +61,7 @@ class ContactType(ContactAssignmentsMixin, NetBoxObjectType):
@strawberry_django.type(
models.ContactRole,
fields='__all__',
filters=ContactRoleFilter
# filters=ContactRoleFilter
)
class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
pass
@ -70,7 +70,7 @@ class ContactRoleType(ContactAssignmentsMixin, OrganizationalObjectType):
@strawberry_django.type(
models.ContactGroup,
fields='__all__',
filters=ContactGroupFilter
# filters=ContactGroupFilter
)
class ContactGroupType(OrganizationalObjectType):
pass
@ -79,7 +79,7 @@ class ContactGroupType(OrganizationalObjectType):
@strawberry_django.type(
models.ContactAssignment,
fields='__all__',
filters=ContactAssignmentFilter
# filters=ContactAssignmentFilter
)
class ContactAssignmentType(CustomFieldsMixin, TagsMixin, BaseObjectType):
pass

View File

@ -107,4 +107,5 @@ class L2VPNType(ContactsMixin, NetBoxObjectType):
filters=L2VPNTerminationFilter
)
class L2VPNTerminationType(NetBoxObjectType):
assigned_object = graphene.Field('vpn.graphql.gfk_mixins.L2VPNAssignmentType')
# assigned_object = graphene.Field('vpn.graphql.gfk_mixins.L2VPNAssignmentType')
pass