Sha256: 670ad2049539fd9f86591db16a7e44d524ad44ec0c42ccab58b8d365c09d4ae5

Contents?: true

Size: 700 Bytes

Versions: 107

Compression:

Stored size: 700 Bytes

Contents

# frozen_string_literal: true

<% module_namespacing_when_supported do -%>
module Mutations
  class <%= class_name %>Delete < BaseMutation
    description "Deletes a <%= file_name %> by ID"

    field :<%= file_name %>, Types::<%= options[:namespaced_types] ? 'Objects::' : '' %><%= class_name %>Type, null: false

    argument :id, ID, required: true

    def resolve(id:)
      <%= singular_table_name %> = ::<%= orm_class.find(class_name, "id") %>
      raise GraphQL::ExecutionError.new "Error deleting <%= file_name %>", extensions: <%= singular_table_name %>.errors.to_hash unless <%= orm_instance.destroy %>

      { <%= file_name %>: <%= singular_table_name %> }
    end
  end
end
<% end -%>

Version data entries

107 entries across 107 versions & 1 rubygems

Version Path
graphql-2.4.8 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.7 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.6 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.5 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.4 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.3 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.2 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.1 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.4.0 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.20 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.19 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.18 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.17 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.16 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.15 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.14 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.13 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.12 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.11 lib/generators/graphql/templates/mutation_delete.erb
graphql-2.3.10 lib/generators/graphql/templates/mutation_delete.erb