graphql_python_template/app/schema/mutations/create_todo.py
2020-10-22 13:07:38 +02:00

15 lines
No EOL
355 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)