2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class ReleaseType < BaseObject
|
|
|
|
graphql_name 'Release'
|
2020-07-28 23:09:34 +05:30
|
|
|
description 'Represents a release'
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
authorize :read_release
|
|
|
|
|
|
|
|
alias_method :release, :object
|
|
|
|
|
|
|
|
present_using ReleasePresenter
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
field :tag_name, GraphQL::STRING_TYPE, null: true, method: :tag,
|
|
|
|
description: 'Name of the tag associated with the release',
|
|
|
|
authorize: :download_code
|
2020-05-24 23:13:21 +05:30
|
|
|
field :tag_path, GraphQL::STRING_TYPE, null: true,
|
2020-07-28 23:09:34 +05:30
|
|
|
description: 'Relative web path to the tag associated with the release',
|
|
|
|
authorize: :download_code
|
2020-05-24 23:13:21 +05:30
|
|
|
field :description, GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Description (also known as "release notes") of the release'
|
|
|
|
markdown_field :description_html, null: true
|
|
|
|
field :name, GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Name of the release'
|
|
|
|
field :created_at, Types::TimeType, null: true,
|
|
|
|
description: 'Timestamp of when the release was created'
|
|
|
|
field :released_at, Types::TimeType, null: true,
|
|
|
|
description: 'Timestamp of when the release was released'
|
2020-06-23 00:09:42 +05:30
|
|
|
field :assets, Types::ReleaseAssetsType, null: true, method: :itself,
|
|
|
|
description: 'Assets of the release'
|
2020-07-28 23:09:34 +05:30
|
|
|
field :links, Types::ReleaseLinksType, null: true, method: :itself,
|
|
|
|
description: 'Links of the release'
|
2020-05-24 23:13:21 +05:30
|
|
|
field :milestones, Types::MilestoneType.connection_type, null: true,
|
|
|
|
description: 'Milestones associated to the release'
|
2020-06-23 00:09:42 +05:30
|
|
|
field :evidences, Types::EvidenceType.connection_type, null: true,
|
|
|
|
description: 'Evidence for the release'
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
field :author, Types::UserType, null: true,
|
|
|
|
description: 'User that created the release'
|
|
|
|
|
|
|
|
def author
|
|
|
|
Gitlab::Graphql::Loaders::BatchModelLoader.new(User, release.author_id).find
|
|
|
|
end
|
|
|
|
|
|
|
|
field :commit, Types::CommitType, null: true,
|
|
|
|
complexity: 10, calls_gitaly: true,
|
2020-07-28 23:09:34 +05:30
|
|
|
description: 'The commit associated with the release'
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
def commit
|
|
|
|
return if release.sha.nil?
|
|
|
|
|
|
|
|
release.project.commit_by(oid: release.sha)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|