2020-06-25 06:08:50 +00:00
|
|
|
# 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,
|
|
|
|
description: 'Number of lines added'
|
|
|
|
field :deletions, GraphQL::INT_TYPE, null: false,
|
|
|
|
description: 'Number of lines deleted'
|
|
|
|
field :changes, GraphQL::INT_TYPE, null: false,
|
|
|
|
description: 'Number of lines changed'
|
2020-07-02 15:09:08 +00:00
|
|
|
field :file_count, GraphQL::INT_TYPE, null: false,
|
|
|
|
description: 'Number of files changed'
|
2020-06-25 06:08:50 +00:00
|
|
|
|
|
|
|
def changes
|
|
|
|
object[:additions] + object[:deletions]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
# rubocop: enable Graphql/AuthorizeTypes
|
|
|
|
end
|