mutations.rb 726 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
  2. module Gql::EntryPoints
  3. class Mutations < Gql::Types::BaseObject
  4. description 'All available mutations.'
  5. # No auth required for the main mutation entry point, Gql::mutations perform their own auth handling.
  6. def self.requires_authentication?
  7. false
  8. end
  9. # Load all available Gql::mutations so that they can be iterated.
  10. Mixin::RequiredSubPaths.eager_load_recursive("#{__dir__}/../mutations")
  11. ::Gql::Mutations::BaseMutation.descendants.each do |mutation|
  12. field_name = mutation.name.sub('Gql::Mutations::', '').gsub('::', '').camelize(:lower).to_sym
  13. field field_name, mutation: mutation
  14. end
  15. end
  16. end