Skip to content

Commit

Permalink
Closes #212 and Fixes #210
Browse files Browse the repository at this point in the history
  • Loading branch information
cruse1977 committed Sep 19, 2024
1 parent 38e8f98 commit 79b7756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
4 changes: 1 addition & 3 deletions netbox_acls/graphql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from .types import *

schema = [
schema.NetBoxACLSAccessListQuery,
schema.NetBoxACLSStandardRuleQuery,
schema.NetBoxACLSACLExtendedRuleQuery
schema.NetBoxACLSQuery
]

30 changes: 9 additions & 21 deletions netbox_acls/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 79b7756

Please sign in to comment.