INNER CODE UNIT · Python

mutate_and_get_payload

phalt/django-api-domains · example_domain/apis.py:39

    def mutate_and_get_payload(cls, root, info, **input):
        new_book = BookService.create_book(
            name=input.get('book_name'),
            author_id=input.get('author_id')
        )
        return BookEntity(
            name=new_book['name'],
            author_name=new_book['author_name'],
        )


# graphQL mutation
class UpdateBookAndAuthorName(relay.ClientIDMutation):
    class Input:
        book_name = graphene.String(required=True)
        author_name = graphene.String(required=True)
        author_id = graphene.ID(required=True)
        book_id = graphene.ID(required=True)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…