1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/netbox/tenancy/graphql/schema.py
2024-03-06 14:34:51 -08:00

40 lines
1.3 KiB
Python

from typing import List
import strawberry
import strawberry_django
from tenancy import models
from .types import *
@strawberry.type
class TenancyQuery:
@strawberry.field
def tenant(self, id: int) -> TenantType:
return models.Tenant.objects.get(id=id)
tenant_list: List[TenantType] = strawberry_django.field()
@strawberry.field
def tenant_group(self, id: int) -> TenantGroupType:
return models.TenantGroup.objects.get(id=id)
tenant_group_list: List[TenantGroupType] = strawberry_django.field()
@strawberry.field
def contact(self, id: int) -> ContactType:
return models.Contact.objects.get(id=id)
contact_list: List[ContactType] = strawberry_django.field()
@strawberry.field
def contact_role(self, id: int) -> ContactRoleType:
return models.ContactRole.objects.get(id=id)
contact_role_list: List[ContactRoleType] = strawberry_django.field()
@strawberry.field
def contact_group(self, id: int) -> ContactGroupType:
return models.ContactGroup.objects.get(id=id)
contact_group_list: List[ContactGroupType] = strawberry_django.field()
@strawberry.field
def contact_assignment(self, id: int) -> ContactAssignmentType:
return models.ContactAssignment.objects.get(id=id)
contact_assignment_list: List[ContactAssignmentType] = strawberry_django.field()