diff --git a/netbox_acls/graphql/__init__.py b/netbox_acls/graphql/__init__.py index f778a806..8e9089c1 100644 --- a/netbox_acls/graphql/__init__.py +++ b/netbox_acls/graphql/__init__.py @@ -2,8 +2,6 @@ from .types import * schema = [ - schema.NetBoxACLSAccessListQuery, - schema.NetBoxACLSStandardRuleQuery, - schema.NetBoxACLSACLExtendedRuleQuery + schema.NetBoxACLSQuery ] diff --git a/netbox_acls/graphql/schema.py b/netbox_acls/graphql/schema.py index 94b707d5..27d7e9e7 100644 --- a/netbox_acls/graphql/schema.py +++ b/netbox_acls/graphql/schema.py @@ -2,31 +2,19 @@ import strawberry_django from .types import * from ..models import * +from typing import List -@strawberry.type -class NetBoxACLSAccessListQuery: +@strawberry.type(name="Query") +class NetBoxACLSQuery: """ Defines the queries available to this plugin via the graphql api. """ - @strawberry.field - def access_list(self, id: int) -> AccessListType: - return AccessList.objects.get(pk=id) - access_list_list: list[AccessListType] = strawberry_django.field() + access_list: AccessListType = strawberry_django.field() + access_list_list: List[AccessListType] = strawberry_django.field() -@strawberry.type -class NetBoxACLSACLExtendedRuleQuery: - @strawberry.field - def acl_extended_rule(self, id: int) -> ACLExtendedRuleType: - return ACLExtendedRule.objects.get(pk=id) - acl_extended_rule_list: list[ACLExtendedRuleType] = strawberry_django.field() - - - -@strawberry.type -class NetBoxACLSStandardRuleQuery: - @strawberry.field - def acl_standard_rule(self, id: int) -> ACLStandardRuleType: - return ACLStandardRule.objects.get(pk=id) - acl_standard_rule_list: list[ACLStandardRuleType] = strawberry_django.field() + acl_extended_rule: ACLExtendedRuleType = strawberry_django.field() + acl_extended_rule_list: List[ACLExtendedRuleType] = strawberry_django.field() + acl_standard_rule: ACLStandardRuleType = strawberry_django.field() + acl_standard_rule_list: List[ACLStandardRuleType] = strawberry_django.field()