Sha256: 66e8d267f22c97300988a43489f41823240ab0d35fa2a3d02e7f6e4de0f638b5

Contents?: true

Size: 680 Bytes

Versions: 2

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

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

        argument :id, ID, required: true

        field :oauth_client, Types::OauthClient, null: false
        field :errors, [String], null: false

        def resolve(id:)
          oauth_client = Osso::Models::OauthClient.find(id)
          oauth_client.regenerate_secrets!

          return response_data(oauth_client: oauth_client) if oauth_client.save

          response_error(errors: oauth_client.errors.full_messages)
        end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
osso-0.0.3.26 lib/osso/graphql/mutations/regenerate_oauth_credentials.rb
osso-0.0.3.25 lib/osso/graphql/mutations/regenerate_oauth_credentials.rb