44 lines
952 B
Python
44 lines
952 B
Python
import graphene
|
|
from graphene import relay
|
|
from graphene_django import DjangoObjectType
|
|
|
|
from notes.models import Note, ContentBlockBookmark, ModuleBookmark, ChapterBookmark
|
|
|
|
|
|
class NoteNode(DjangoObjectType):
|
|
pk = graphene.Int()
|
|
|
|
class Meta:
|
|
model = Note
|
|
interfaces = (relay.Node,)
|
|
|
|
def resolve_pk(self, *args, **kwargs):
|
|
return self.id
|
|
|
|
|
|
class ContentBlockBookmarkNode(DjangoObjectType):
|
|
# note = graphene.
|
|
uuid = graphene.UUID()
|
|
note = graphene.Field(NoteNode)
|
|
|
|
class Meta:
|
|
model = ContentBlockBookmark
|
|
filter_fields = []
|
|
interfaces = (relay.Node,)
|
|
|
|
|
|
class ModuleBookmarkNode(DjangoObjectType):
|
|
note = graphene.Field(NoteNode)
|
|
|
|
class Meta:
|
|
model = ModuleBookmark
|
|
|
|
|
|
class ChapterBookmarkNode(DjangoObjectType):
|
|
note = graphene.Field(NoteNode)
|
|
|
|
class Meta:
|
|
model = ChapterBookmark
|
|
filter_fields = []
|
|
interfaces = (relay.Node,)
|