Welcome to mirror list, hosted at ThFree Co, Russian Federation.

diff_stats_summary_type.rb « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 78c0e2f2b4c96d24765ee66353aca76fb9b3b6f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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.'
    field :file_count, GraphQL::INT_TYPE, null: false,
          description: 'Number of files changed.'

    def changes
      object[:additions] + object[:deletions]
    end
  end
  # rubocop: enable Graphql/AuthorizeTypes
end