Skip to content
Snippets Groups Projects
Commit 7624b62c authored by Julian's avatar Julian
Browse files

Create schema for Rooms

parent 5d7285b6
No related branches found
No related tags found
3 merge requests!1237Release 3.0,!1207Resolve "Move DeleteDialog from Plank to Core",!1183Release 3.0
Pipeline #118547 failed
...@@ -30,6 +30,7 @@ Added ...@@ -30,6 +30,7 @@ Added
* [Dev] Introduce new mechanism to register classes over all apps. * [Dev] Introduce new mechanism to register classes over all apps.
* Data template for `room` model used for haystack search indexing moved to core. * Data template for `room` model used for haystack search indexing moved to core.
* Support for two factor authentication via email codes and Webauthn. * Support for two factor authentication via email codes and Webauthn.
* GraphQL schema for Rooms
Changed Changed
~~~~~~~ ~~~~~~~
......
...@@ -9,7 +9,15 @@ from haystack.inputs import AutoQuery ...@@ -9,7 +9,15 @@ from haystack.inputs import AutoQuery
from haystack.query import SearchQuerySet from haystack.query import SearchQuerySet
from haystack.utils.loading import UnifiedIndex from haystack.utils.loading import UnifiedIndex
from ..models import CustomMenu, DynamicRoute, Notification, PDFFile, Person, TaskUserAssignment from ..models import (
CustomMenu,
DynamicRoute,
Notification,
PDFFile,
Person,
Room,
TaskUserAssignment,
)
from ..util.apps import AppConfig from ..util.apps import AppConfig
from ..util.core_helpers import get_allowed_object_ids, get_app_module, get_app_packages, has_person from ..util.core_helpers import get_allowed_object_ids, get_app_module, get_app_packages, has_person
from .celery_progress import CeleryProgressFetchedMutation, CeleryProgressType from .celery_progress import CeleryProgressFetchedMutation, CeleryProgressType
...@@ -21,6 +29,7 @@ from .message import MessageType ...@@ -21,6 +29,7 @@ from .message import MessageType
from .notification import MarkNotificationReadMutation, NotificationType from .notification import MarkNotificationReadMutation, NotificationType
from .pdf import PDFFileType from .pdf import PDFFileType
from .person import PersonMutation, PersonType from .person import PersonMutation, PersonType
from .room import RoomType
from .school_term import SchoolTermType # noqa from .school_term import SchoolTermType # noqa
from .search import SearchResultType from .search import SearchResultType
from .system_properties import SystemPropertiesType from .system_properties import SystemPropertiesType
...@@ -59,6 +68,8 @@ class Query(graphene.ObjectType): ...@@ -59,6 +68,8 @@ class Query(graphene.ObjectType):
two_factor = graphene.Field(TwoFactorType) two_factor = graphene.Field(TwoFactorType)
rooms = graphene.List(RoomType)
def resolve_ping(root, info, payload) -> str: def resolve_ping(root, info, payload) -> str:
return payload return payload
...@@ -157,6 +168,12 @@ class Query(graphene.ObjectType): ...@@ -157,6 +168,12 @@ class Query(graphene.ObjectType):
return None return None
return info.context.user return info.context.user
@staticmethod
def resolve_rooms(root, info, **kwargs):
if info.context.user.is_anonymous:
return []
return Room.objects.all()
class Mutation(graphene.ObjectType): class Mutation(graphene.ObjectType):
update_person = PersonMutation.Field() update_person = PersonMutation.Field()
......
from graphene_django import DjangoObjectType
from ..models import Room
class RoomType(DjangoObjectType):
class Meta:
model = Room
fields = ("id", "name", "short_name")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment