Sha256: 13d5464c70e2b5afdd55a9cd99f11f67e33bc9c898c84aeec92a479bdae86b6e

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

# frozen_string_literal: true

module Osso
  module GraphQL
    module Mutations
      class UpdateAppConfig < BaseMutation
        null false

        argument :name, String, required: false
        argument :logo_url, String, required: false
        argument :contact_email, String, required: false

        field :app_config, Types::AppConfig, null: true
        field :errors, [String], null: false

        def resolve(**args)
          app_config = Osso::Models::AppConfig.find
          if app_config.update(**args)
            Osso::Analytics.capture(email: context[:email], event: self.class.name.demodulize, properties: args)
            return response_data(app_config: app_config)
          end

          response_error(app_config.errors)
        end

        def ready?(*)
          admin_ready?
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
osso-0.1.2 lib/osso/graphql/mutations/update_app_config.rb
osso-0.1.1 lib/osso/graphql/mutations/update_app_config.rb
osso-0.1.0 lib/osso/graphql/mutations/update_app_config.rb
osso-0.0.11 lib/osso/graphql/mutations/update_app_config.rb