2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Types
|
|
|
|
# rubocop: disable Graphql/AuthorizeTypes
|
|
|
|
# Types that use DiffStatsType should have their own authorization
|
|
|
|
class DiffStatsSummaryType < BaseObject
|
|
|
|
graphql_name 'DiffStatsSummary'
|
|
|
|
|
|
|
|
description 'Aggregated summary of changes'
|
|
|
|
|
|
|
|
field :additions, GraphQL::INT_TYPE, null: false,
|
2021-03-11 19:13:27 +05:30
|
|
|
description: 'Number of lines added.'
|
2020-07-28 23:09:34 +05:30
|
|
|
field :deletions, GraphQL::INT_TYPE, null: false,
|
2021-03-11 19:13:27 +05:30
|
|
|
description: 'Number of lines deleted.'
|
2020-07-28 23:09:34 +05:30
|
|
|
field :changes, GraphQL::INT_TYPE, null: false,
|
2021-03-11 19:13:27 +05:30
|
|
|
description: 'Number of lines changed.'
|
2020-07-28 23:09:34 +05:30
|
|
|
field :file_count, GraphQL::INT_TYPE, null: false,
|
2021-03-11 19:13:27 +05:30
|
|
|
description: 'Number of files changed.'
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
def changes
|
|
|
|
object[:additions] + object[:deletions]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
# rubocop: enable Graphql/AuthorizeTypes
|
|
|
|
end
|