Sha256: f056dd6fbf62f3bc865575f761bbe2a8d63f06cb04ac4ee107aabb4725efaac7
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
# frozen_string_literal: true module Osso module GraphQL module Mutations class MarkRedirectUriPrimary < 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 oauth_client.redirect_uris.update(primary: false) redirect_uri.update(primary: true) response_data(oauth_client: oauth_client.reload) rescue StandardError => e response_error(errors: e.message) 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/mark_redirect_uri_primary.rb |