2024-03-22 09:56:30 -07:00
|
|
|
from typing import List
|
|
|
|
|
|
|
|
import strawberry
|
|
|
|
import strawberry_django
|
2021-06-25 14:19:20 -04:00
|
|
|
|
2023-03-23 05:42:18 -07:00
|
|
|
from tenancy import models
|
2021-06-25 14:19:20 -04:00
|
|
|
from .types import *
|
2023-03-23 05:42:18 -07:00
|
|
|
|
|
|
|
|
2024-03-22 09:56:30 -07:00
|
|
|
@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()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def tenant_group(self, id: int) -> TenantGroupType:
|
|
|
|
return models.TenantGroup.objects.get(pk=id)
|
|
|
|
tenant_group_list: List[TenantGroupType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def contact(self, id: int) -> ContactType:
|
|
|
|
return models.Contact.objects.get(pk=id)
|
|
|
|
contact_list: List[ContactType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def contact_role(self, id: int) -> ContactRoleType:
|
|
|
|
return models.ContactRole.objects.get(pk=id)
|
|
|
|
contact_role_list: List[ContactRoleType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def contact_group(self, id: int) -> ContactGroupType:
|
|
|
|
return models.ContactGroup.objects.get(pk=id)
|
|
|
|
contact_group_list: List[ContactGroupType] = strawberry_django.field()
|
|
|
|
|
|
|
|
@strawberry.field
|
|
|
|
def contact_assignment(self, id: int) -> ContactAssignmentType:
|
|
|
|
return models.ContactAssignment.objects.get(pk=id)
|
|
|
|
contact_assignment_list: List[ContactAssignmentType] = strawberry_django.field()
|