summaryrefslogtreecommitdiff
path: root/app/graphql/types/branch_rules/branch_protection_type.rb
blob: 4177a6f92a19a5cbb0f9ea7f57f789e2afecb876 (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
26
27
28
29
# frozen_string_literal: true

module Types
  module BranchRules
    class BranchProtectionType < BaseObject
      graphql_name 'BranchProtection'
      description 'Branch protection details for a branch rule.'
      accepts ::ProtectedBranch
      authorize :read_protected_branch

      field :merge_access_levels,
            type: Types::BranchProtections::MergeAccessLevelType.connection_type,
            null: true,
            description: 'Details about who can merge when this branch is the source branch.'

      field :push_access_levels,
            type: Types::BranchProtections::PushAccessLevelType.connection_type,
            null: true,
            description: 'Details about who can push when this branch is the source branch.'

      field :allow_force_push,
            type: GraphQL::Types::Boolean,
            null: false,
            description: 'Toggle force push to the branch for users with write access.'
    end
  end
end

Types::BranchRules::BranchProtectionType.prepend_mod_with('Types::BranchRules::BranchProtectionType')