2020-05-06 20:11:11 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
|
|
|
class ReleaseResolver < BaseResolver
|
|
|
|
type Types::ReleaseType, null: true
|
|
|
|
|
|
|
|
argument :tag_name, GraphQL::STRING_TYPE,
|
|
|
|
required: true,
|
|
|
|
description: 'The name of the tag associated to the release'
|
|
|
|
|
|
|
|
alias_method :project, :object
|
|
|
|
|
|
|
|
def self.single
|
|
|
|
self
|
|
|
|
end
|
|
|
|
|
|
|
|
def resolve(tag_name:)
|
2020-06-24 23:08:52 -04:00
|
|
|
return unless Feature.enabled?(:graphql_release_data, project, default_enabled: true)
|
|
|
|
|
2020-05-06 20:11:11 -04:00
|
|
|
ReleasesFinder.new(
|
|
|
|
project,
|
|
|
|
current_user,
|
|
|
|
{ tag: tag_name }
|
|
|
|
).execute.first
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|