Skip to content

Instantly share code, notes, and snippets.

@maxloncar
Created March 9, 2023 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxloncar/7b774fd9f66bd9f576c8063083941af9 to your computer and use it in GitHub Desktop.
Save maxloncar/7b774fd9f66bd9f576c8063083941af9 to your computer and use it in GitHub Desktop.
CreateBook file
class Mutations::CreateBook < Mutations::BaseMutation
argument :title, String, required: true
argument :pages, Integer, required: true
argument :year_published, Integer, required: false
type Types::BookType
def resolve(title:, pages:, year_published:)
Book.new(
title: title,
pages: pages,
year_published: year_published)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment