2019-09-30 21:07:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class CommitType < BaseObject
|
|
|
|
graphql_name 'Commit'
|
|
|
|
|
|
|
|
authorize :download_code
|
|
|
|
|
|
|
|
present_using CommitPresenter
|
|
|
|
|
2019-12-26 22:10:19 +05:30
|
|
|
field :id, type: GraphQL::ID_TYPE, null: false,
|
|
|
|
description: 'ID (global ID) of the commit'
|
|
|
|
field :sha, type: GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'SHA1 ID of the commit'
|
2020-03-13 15:44:24 +05:30
|
|
|
field :title, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
|
2019-12-26 22:10:19 +05:30
|
|
|
description: 'Title of the commit message'
|
2020-05-24 23:13:21 +05:30
|
|
|
markdown_field :title_html, null: true
|
2019-12-26 22:10:19 +05:30
|
|
|
field :description, type: GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Description of the commit message'
|
2020-10-24 23:57:45 +05:30
|
|
|
markdown_field :description_html, null: true
|
2019-12-26 22:10:19 +05:30
|
|
|
field :message, type: GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Raw commit message'
|
|
|
|
field :authored_date, type: Types::TimeType, null: true,
|
|
|
|
description: 'Timestamp of when the commit was authored'
|
|
|
|
field :web_url, type: GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Web URL of the commit'
|
2020-10-24 23:57:45 +05:30
|
|
|
field :web_path, type: GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Web path of the commit'
|
2019-12-26 22:10:19 +05:30
|
|
|
field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
|
|
|
|
description: 'Rendered HTML of the commit signature'
|
|
|
|
field :author_name, type: GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Commit authors name'
|
2020-03-13 15:44:24 +05:30
|
|
|
field :author_gravatar, type: GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Commit authors gravatar',
|
|
|
|
resolve: -> (commit, args, context) do
|
|
|
|
GravatarService.new.execute(commit.author_email, 40)
|
|
|
|
end
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
# models/commit lazy loads the author by email
|
2019-12-26 22:10:19 +05:30
|
|
|
field :author, type: Types::UserType, null: true,
|
|
|
|
description: 'Author of the commit'
|
|
|
|
|
|
|
|
field :pipelines, Types::Ci::PipelineType.connection_type,
|
|
|
|
null: true,
|
|
|
|
description: 'Pipelines of the commit ordered latest first',
|
|
|
|
resolver: Resolvers::CommitPipelinesResolver
|
2019-09-30 21:07:59 +05:30
|
|
|
|
|
|
|
field :latest_pipeline,
|
|
|
|
type: Types::Ci::PipelineType,
|
|
|
|
null: true,
|
2020-04-22 19:07:51 +05:30
|
|
|
deprecated: { reason: 'Use `pipelines`', milestone: '12.5' },
|
|
|
|
description: 'Latest pipeline of the commit',
|
2019-12-26 22:10:19 +05:30
|
|
|
resolver: Resolvers::CommitPipelinesResolver.last
|
2019-09-30 21:07:59 +05:30
|
|
|
end
|
|
|
|
end
|