evg-app-back/organisations/query.py

26 lines
786 B
Python
Raw Normal View History

2021-01-10 15:51:59 +03:00
import graphene
2021-01-20 22:10:57 +03:00
from .gqlTypes import OrganisationType, RoleType, TeacherType, ChildType, GroupType
2021-01-10 15:51:59 +03:00
from .models import Organisation, Role
2021-01-20 22:10:57 +03:00
from graphene import relay
2021-01-10 15:51:59 +03:00
2021-01-20 22:10:57 +03:00
from graphene_django.filter import DjangoFilterConnectionField
2021-01-10 15:51:59 +03:00
class Query(graphene.ObjectType):
roles = graphene.Field(graphene.List(RoleType))
2021-01-20 22:10:57 +03:00
organisations = DjangoFilterConnectionField(OrganisationType)
organisation = relay.Node.Field(OrganisationType)
teachers = DjangoFilterConnectionField(TeacherType)
teacher = relay.Node.Field(TeacherType)
children = DjangoFilterConnectionField(ChildType)
child = relay.Node.Field(ChildType)
group = relay.Node.Field(GroupType)
groups = DjangoFilterConnectionField(GroupType)
2021-01-10 15:51:59 +03:00
def resolve_roles(self, info, **kwargs):
return Role.objects.all()