30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
from graphene import InputObjectType
|
|
import graphene
|
|
|
|
|
|
class InputTypes(graphene.Enum):
|
|
text_block = 'text_block'
|
|
basic_knowledge = 'basic_knowledge'
|
|
student_entry = 'student_entry'
|
|
image_block = 'image_block'
|
|
link_block = 'link_block'
|
|
task = 'task'
|
|
|
|
|
|
class ContentElementInput(InputObjectType):
|
|
# we'll handle this with a single input, even tho it would be nice to have a type for every different possibility
|
|
# see discussion at https://github.com/graphql/graphql-js/issues/207
|
|
type = InputTypes(required=True)
|
|
text = graphene.String(description='To be used for link_block, text_block types')
|
|
url = graphene.String(description='To be used for link, basic_knowledge, image_block types')
|
|
description = graphene.String(description='To be used for basic_knowledge type')
|
|
title = graphene.String(description='To be used for image_block type')
|
|
task_text = graphene.String(description='To be used for task type')
|
|
|
|
|
|
class ContentBlockInput(InputObjectType):
|
|
title = graphene.String(required=True)
|
|
type = graphene.String()
|
|
after = graphene.ID()
|
|
contents = graphene.List(ContentElementInput)
|