Sha256: 8a290d0134b9230250edbd4bf813178ed39e102f078084a2910f85efbd32c181
Contents?: true
Size: 953 Bytes
Versions: 1
Compression:
Stored size: 953 Bytes
Contents
# frozen_string_literal: true module Osso module GraphQL module Mutations class DeleteRedirectUri < BaseMutation null false argument :id, ID, required: true field :oauth_client, Types::OauthClient, null: true field :errors, [String], null: false def resolve(id:) redirect_uri = Osso::Models::RedirectUri.find(id) oauth_client = redirect_uri.oauth_client redirect_uri.destroy if redirect_uri.primary oauth_client.redirect_uris.first&.update(primary: true) end return response_data(oauth_client: oauth_client.reload) if redirect_uri.destroy response_error(errors: redirect_uri.errors.full_messages) end def ready?(*) return true if context[:scope] == :admin raise ::GraphQL::ExecutionError, 'Only admin users may mutate OauthClients' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
osso-0.0.3.12 | lib/osso/graphql/mutations/delete_redirect_uri.rb |