graphql_python_template/app/schema/mutations/create_todo.py
2020-10-30 12:28:06 +01:00

15 lines
356 B
Python

import graphene
from app.schema.types.todo import TodoType
from app.usecases import create_todo
class CreateTodo(graphene.Mutation):
class Arguments:
title = graphene.String(default_value="")
todo = graphene.Field(TodoType)
def mutate(self, info, title: str):
todo = create_todo(title)
return CreateTodo(todo=todo)