2019-06-28 07:30:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
class CommitType < BaseObject
|
|
|
|
graphql_name 'Commit'
|
|
|
|
|
|
|
|
authorize :download_code
|
|
|
|
|
|
|
|
present_using CommitPresenter
|
|
|
|
|
2019-10-31 12:06:26 +00:00
|
|
|
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-12-09 18:09:48 +00:00
|
|
|
field :short_id, type: GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Short SHA1 ID of the commit'
|
2020-01-21 12:08:31 +00:00
|
|
|
field :title, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
|
2019-10-31 12:06:26 +00:00
|
|
|
description: 'Title of the commit message'
|
2020-05-13 21:08:55 +00:00
|
|
|
markdown_field :title_html, null: true
|
2019-10-31 12:06:26 +00:00
|
|
|
field :description, type: GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Description of the commit message'
|
2020-07-23 15:09:28 +00:00
|
|
|
markdown_field :description_html, null: true
|
2019-10-31 12:06:26 +00:00
|
|
|
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-07-23 15:09:28 +00:00
|
|
|
field :web_path, type: GraphQL::STRING_TYPE, null: false,
|
|
|
|
description: 'Web path of the commit'
|
2019-10-31 12:06:26 +00:00
|
|
|
field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
|
|
|
|
description: 'Rendered HTML of the commit signature'
|
2019-11-18 18:06:53 +00:00
|
|
|
field :author_name, type: GraphQL::STRING_TYPE, null: true,
|
|
|
|
description: 'Commit authors name'
|
2020-02-11 12:08:52 +00:00
|
|
|
field :author_gravatar, type: GraphQL::STRING_TYPE, null: true,
|
2020-12-01 12:09:17 +00:00
|
|
|
description: 'Commit authors gravatar'
|
2019-06-28 07:30:29 +00:00
|
|
|
|
|
|
|
# models/commit lazy loads the author by email
|
2019-10-31 12:06:26 +00:00
|
|
|
field :author, type: Types::UserType, null: true,
|
|
|
|
description: 'Author of the commit'
|
2019-06-28 07:30:29 +00:00
|
|
|
|
2020-11-17 18:09:20 +00:00
|
|
|
field :pipelines,
|
2019-11-14 12:06:30 +00:00
|
|
|
null: true,
|
|
|
|
description: 'Pipelines of the commit ordered latest first',
|
|
|
|
resolver: Resolvers::CommitPipelinesResolver
|
2020-12-01 12:09:17 +00:00
|
|
|
|
|
|
|
def author_gravatar
|
|
|
|
GravatarService.new.execute(object.author_email, 40)
|
|
|
|
end
|
2019-06-28 07:30:29 +00:00
|
|
|
end
|
|
|
|
end
|