graphql_python_template/app/schema/mutations/todo/close_todo.py
2020-11-08 12:46:41 +01:00

17 lines
433 B
Python

import graphene
from app.schema.types.todo import TodoResponseField
from app.usecases.todo import close_todo
class CloseTodo(graphene.Mutation):
"""Close an existing task"""
class Arguments:
todo_id = graphene.String(required=True)
result = graphene.Field(TodoResponseField)
def mutate(self, info, todo_id: str):
todo = close_todo(todo_id)
return CloseTodo(TodoResponseField(todo=todo))