mirror of
https://github.com/rjNemo/graphql_python_template
synced 2026-06-06 02:26:47 +00:00
17 lines
427 B
Python
17 lines
427 B
Python
import graphene
|
|
|
|
from app.schema.types.todo import TodoResponseField
|
|
from app.usecases.todo import create_todo
|
|
|
|
|
|
class CreateTodo(graphene.Mutation):
|
|
"""Create a new task."""
|
|
|
|
class Arguments:
|
|
title = graphene.String(required=True)
|
|
|
|
result = graphene.Field(TodoResponseField)
|
|
|
|
def mutate(self, info, title: str):
|
|
todo = create_todo(title)
|
|
return CreateTodo(TodoResponseField(todo=todo))
|