From dbd0d52f3f326591e516e2d7b286960182a3be5c Mon Sep 17 00:00:00 2001 From: Lee Tickett <ltickett@gitlab.com> Date: Thu, 20 Jul 2023 20:47:28 +0100 Subject: [PATCH] Improve GraphQL connection_type_class DSL syntax --- app/graphql/types/ci/group_environment_scope_type.rb | 2 +- app/graphql/types/ci/group_variable_type.rb | 2 +- app/graphql/types/ci/job_type.rb | 2 +- app/graphql/types/ci/pipeline_schedule_type.rb | 2 +- app/graphql/types/ci/pipeline_type.rb | 2 +- app/graphql/types/ci/project_variable_type.rb | 2 +- app/graphql/types/ci/recent_failures_type.rb | 2 +- app/graphql/types/ci/runner_manager_type.rb | 2 +- app/graphql/types/ci/runner_type.rb | 2 +- app/graphql/types/ci/test_case_type.rb | 2 +- app/graphql/types/ci/test_suite_summary_type.rb | 2 +- app/graphql/types/ci/test_suite_type.rb | 2 +- app/graphql/types/clusters/agent_activity_event_type.rb | 2 +- app/graphql/types/clusters/agent_token_type.rb | 2 +- app/graphql/types/clusters/agent_type.rb | 2 +- app/graphql/types/issue_type.rb | 2 +- app/graphql/types/label_type.rb | 2 +- app/graphql/types/merge_request_type.rb | 2 +- app/graphql/types/packages/package_base_type.rb | 2 +- app/graphql/types/project_type.rb | 2 +- app/graphql/types/release_type.rb | 2 +- app/graphql/types/saved_reply_type.rb | 2 +- app/graphql/types/snippets/blob_type.rb | 2 +- app/graphql/types/terraform/state_type.rb | 2 +- app/graphql/types/timelog_type.rb | 2 +- ee/app/graphql/types/ci/catalog/resource_type.rb | 2 +- ee/app/graphql/types/ci/code_quality_degradation_type.rb | 2 +- ee/app/graphql/types/dast/profile_type.rb | 2 +- ee/app/graphql/types/epic_type.rb | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/app/graphql/types/ci/group_environment_scope_type.rb b/app/graphql/types/ci/group_environment_scope_type.rb index 3a3a5a3f59feb..0dd0ad963acd5 100644 --- a/app/graphql/types/ci/group_environment_scope_type.rb +++ b/app/graphql/types/ci/group_environment_scope_type.rb @@ -7,7 +7,7 @@ class GroupEnvironmentScopeType < BaseObject graphql_name 'CiGroupEnvironmentScope' description 'Ci/CD environment scope for a group.' - connection_type_class(Types::Ci::GroupEnvironmentScopeConnectionType) + connection_type_class Types::Ci::GroupEnvironmentScopeConnectionType field :name, GraphQL::Types::String, null: true, diff --git a/app/graphql/types/ci/group_variable_type.rb b/app/graphql/types/ci/group_variable_type.rb index 7e2afba0d53c1..acb003b597741 100644 --- a/app/graphql/types/ci/group_variable_type.rb +++ b/app/graphql/types/ci/group_variable_type.rb @@ -7,7 +7,7 @@ class GroupVariableType < BaseObject graphql_name 'CiGroupVariable' description 'CI/CD variables for a group.' - connection_type_class(Types::Ci::GroupVariableConnectionType) + connection_type_class Types::Ci::GroupVariableConnectionType implements(VariableInterface) field :environment_scope, GraphQL::Types::String, diff --git a/app/graphql/types/ci/job_type.rb b/app/graphql/types/ci/job_type.rb index 02b10f3e4bd6f..22eb32993c5c2 100644 --- a/app/graphql/types/ci/job_type.rb +++ b/app/graphql/types/ci/job_type.rb @@ -9,7 +9,7 @@ class JobType < BaseObject present_using ::Ci::BuildPresenter - connection_type_class(Types::LimitedCountableConnectionType) + connection_type_class Types::LimitedCountableConnectionType expose_permissions Types::PermissionTypes::Ci::Job diff --git a/app/graphql/types/ci/pipeline_schedule_type.rb b/app/graphql/types/ci/pipeline_schedule_type.rb index 904fa3f1c72bb..71a1f28ea38c4 100644 --- a/app/graphql/types/ci/pipeline_schedule_type.rb +++ b/app/graphql/types/ci/pipeline_schedule_type.rb @@ -7,7 +7,7 @@ class PipelineScheduleType < BaseObject description 'Represents a pipeline schedule' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType expose_permissions Types::PermissionTypes::Ci::PipelineSchedules diff --git a/app/graphql/types/ci/pipeline_type.rb b/app/graphql/types/ci/pipeline_type.rb index 19d261853a78c..ba638d4bc47fb 100644 --- a/app/graphql/types/ci/pipeline_type.rb +++ b/app/graphql/types/ci/pipeline_type.rb @@ -5,7 +5,7 @@ module Ci class PipelineType < BaseObject graphql_name 'Pipeline' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_pipeline present_using ::Ci::PipelinePresenter diff --git a/app/graphql/types/ci/project_variable_type.rb b/app/graphql/types/ci/project_variable_type.rb index a967900051128..8c1eb481774cc 100644 --- a/app/graphql/types/ci/project_variable_type.rb +++ b/app/graphql/types/ci/project_variable_type.rb @@ -7,7 +7,7 @@ class ProjectVariableType < BaseObject graphql_name 'CiProjectVariable' description 'CI/CD variables for a project.' - connection_type_class(Types::Ci::ProjectVariableConnectionType) + connection_type_class Types::Ci::ProjectVariableConnectionType implements(VariableInterface) field :environment_scope, GraphQL::Types::String, diff --git a/app/graphql/types/ci/recent_failures_type.rb b/app/graphql/types/ci/recent_failures_type.rb index 0892cb2735cd1..37850c626586a 100644 --- a/app/graphql/types/ci/recent_failures_type.rb +++ b/app/graphql/types/ci/recent_failures_type.rb @@ -7,7 +7,7 @@ class RecentFailuresType < BaseObject graphql_name 'RecentFailures' description 'Recent failure history of a test case.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :count, GraphQL::Types::Int, null: true, description: 'Number of times the test case has failed in the past 14 days.' diff --git a/app/graphql/types/ci/runner_manager_type.rb b/app/graphql/types/ci/runner_manager_type.rb index 9c89b6537ea27..b36c8f4286289 100644 --- a/app/graphql/types/ci/runner_manager_type.rb +++ b/app/graphql/types/ci/runner_manager_type.rb @@ -5,7 +5,7 @@ module Ci class RunnerManagerType < BaseObject graphql_name 'CiRunnerManager' - connection_type_class(::Types::CountableConnectionType) + connection_type_class ::Types::CountableConnectionType authorize :read_runner_manager diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index 2baf64ca6636a..cb340675b7213 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -6,7 +6,7 @@ class RunnerType < BaseObject graphql_name 'CiRunner' edge_type_class(RunnerWebUrlEdge) - connection_type_class(RunnerCountableConnectionType) + connection_type_class RunnerCountableConnectionType authorize :read_runner present_using ::Ci::RunnerPresenter diff --git a/app/graphql/types/ci/test_case_type.rb b/app/graphql/types/ci/test_case_type.rb index f88923215eb0b..78c70fbcc7c19 100644 --- a/app/graphql/types/ci/test_case_type.rb +++ b/app/graphql/types/ci/test_case_type.rb @@ -7,7 +7,7 @@ class TestCaseType < BaseObject graphql_name 'TestCase' description 'Test case in pipeline test report.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :status, Types::Ci::TestCaseStatusEnum, diff --git a/app/graphql/types/ci/test_suite_summary_type.rb b/app/graphql/types/ci/test_suite_summary_type.rb index 8801501c8d4ef..a98c47c6a3016 100644 --- a/app/graphql/types/ci/test_suite_summary_type.rb +++ b/app/graphql/types/ci/test_suite_summary_type.rb @@ -7,7 +7,7 @@ class TestSuiteSummaryType < BaseObject graphql_name 'TestSuiteSummary' description 'Test suite summary in a pipeline test report.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :name, GraphQL::Types::String, null: true, description: 'Name of the test suite.' diff --git a/app/graphql/types/ci/test_suite_type.rb b/app/graphql/types/ci/test_suite_type.rb index 8845338ed6db1..a5cc6282abc7e 100644 --- a/app/graphql/types/ci/test_suite_type.rb +++ b/app/graphql/types/ci/test_suite_type.rb @@ -7,7 +7,7 @@ class TestSuiteType < BaseObject graphql_name 'TestSuite' description 'Test suite in a pipeline test report.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :name, GraphQL::Types::String, null: true, description: 'Name of the test suite.' diff --git a/app/graphql/types/clusters/agent_activity_event_type.rb b/app/graphql/types/clusters/agent_activity_event_type.rb index 1d0ec7c4959b8..8c7dfa9c10af9 100644 --- a/app/graphql/types/clusters/agent_activity_event_type.rb +++ b/app/graphql/types/clusters/agent_activity_event_type.rb @@ -7,7 +7,7 @@ class AgentActivityEventType < BaseObject authorize :read_cluster_agent - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :recorded_at, Types::TimeType, diff --git a/app/graphql/types/clusters/agent_token_type.rb b/app/graphql/types/clusters/agent_token_type.rb index 720ee2f685bca..260c634e12ec7 100644 --- a/app/graphql/types/clusters/agent_token_type.rb +++ b/app/graphql/types/clusters/agent_token_type.rb @@ -7,7 +7,7 @@ class AgentTokenType < BaseObject authorize :read_cluster_agent - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :cluster_agent, Types::Clusters::AgentType, diff --git a/app/graphql/types/clusters/agent_type.rb b/app/graphql/types/clusters/agent_type.rb index 317a1aab62899..c098979614195 100644 --- a/app/graphql/types/clusters/agent_type.rb +++ b/app/graphql/types/clusters/agent_type.rb @@ -7,7 +7,7 @@ class AgentType < BaseObject authorize :read_cluster_agent - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :created_at, Types::TimeType, diff --git a/app/graphql/types/issue_type.rb b/app/graphql/types/issue_type.rb index 488e4d10cbcb0..8577d2b8dc5ea 100644 --- a/app/graphql/types/issue_type.rb +++ b/app/graphql/types/issue_type.rb @@ -4,7 +4,7 @@ module Types class IssueType < BaseObject graphql_name 'Issue' - connection_type_class(Types::IssueConnectionType) + connection_type_class Types::IssueConnectionType implements(Types::Notes::NoteableInterface) implements(Types::CurrentUserTodos) diff --git a/app/graphql/types/label_type.rb b/app/graphql/types/label_type.rb index 05b703e60af6e..4848ee30950b0 100644 --- a/app/graphql/types/label_type.rb +++ b/app/graphql/types/label_type.rb @@ -4,7 +4,7 @@ module Types class LabelType < BaseObject graphql_name 'Label' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_label diff --git a/app/graphql/types/merge_request_type.rb b/app/graphql/types/merge_request_type.rb index a142d8f215d9f..30878c17c6bad 100644 --- a/app/graphql/types/merge_request_type.rb +++ b/app/graphql/types/merge_request_type.rb @@ -4,7 +4,7 @@ module Types class MergeRequestType < BaseObject graphql_name 'MergeRequest' - connection_type_class(Types::MergeRequestConnectionType) + connection_type_class Types::MergeRequestConnectionType implements(Types::Notes::NoteableInterface) implements(Types::CurrentUserTodos) diff --git a/app/graphql/types/packages/package_base_type.rb b/app/graphql/types/packages/package_base_type.rb index 8dd2a4467d6cb..cc41169bcda41 100644 --- a/app/graphql/types/packages/package_base_type.rb +++ b/app/graphql/types/packages/package_base_type.rb @@ -6,7 +6,7 @@ class PackageBaseType < ::Types::BaseObject graphql_name 'PackageBase' description 'Represents a package in the Package Registry' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_package diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb index 9d2a57388c716..9e27594bed6d3 100644 --- a/app/graphql/types/project_type.rb +++ b/app/graphql/types/project_type.rb @@ -4,7 +4,7 @@ module Types class ProjectType < BaseObject graphql_name 'Project' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_project diff --git a/app/graphql/types/release_type.rb b/app/graphql/types/release_type.rb index 8516256b433d7..0bf723bcb1bbc 100644 --- a/app/graphql/types/release_type.rb +++ b/app/graphql/types/release_type.rb @@ -5,7 +5,7 @@ class ReleaseType < BaseObject graphql_name 'Release' description 'Represents a release' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_release diff --git a/app/graphql/types/saved_reply_type.rb b/app/graphql/types/saved_reply_type.rb index 8c9f3d198109b..74b3796ef8a3b 100644 --- a/app/graphql/types/saved_reply_type.rb +++ b/app/graphql/types/saved_reply_type.rb @@ -4,7 +4,7 @@ module Types class SavedReplyType < BaseObject graphql_name 'SavedReply' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_saved_replies diff --git a/app/graphql/types/snippets/blob_type.rb b/app/graphql/types/snippets/blob_type.rb index bb4a0a64de84f..2d1993225d141 100644 --- a/app/graphql/types/snippets/blob_type.rb +++ b/app/graphql/types/snippets/blob_type.rb @@ -8,7 +8,7 @@ class BlobType < BaseObject description 'Represents the snippet blob' present_using SnippetBlobPresenter - connection_type_class(Types::Snippets::BlobConnectionType) + connection_type_class Types::Snippets::BlobConnectionType field :rich_data, GraphQL::Types::String, description: 'Blob highlighted data.', diff --git a/app/graphql/types/terraform/state_type.rb b/app/graphql/types/terraform/state_type.rb index be17fc41c2c1d..0870194a934d6 100644 --- a/app/graphql/types/terraform/state_type.rb +++ b/app/graphql/types/terraform/state_type.rb @@ -7,7 +7,7 @@ class StateType < BaseObject authorize :read_terraform_state - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :id, GraphQL::Types::ID, null: false, diff --git a/app/graphql/types/timelog_type.rb b/app/graphql/types/timelog_type.rb index 88baca028efc3..2adf2847221af 100644 --- a/app/graphql/types/timelog_type.rb +++ b/app/graphql/types/timelog_type.rb @@ -4,7 +4,7 @@ module Types class TimelogType < BaseObject graphql_name 'Timelog' - connection_type_class(Types::TimeTracking::TimelogConnectionType) + connection_type_class Types::TimeTracking::TimelogConnectionType authorize :read_issuable diff --git a/ee/app/graphql/types/ci/catalog/resource_type.rb b/ee/app/graphql/types/ci/catalog/resource_type.rb index 773dbf7677d78..ffff5d72275be 100644 --- a/ee/app/graphql/types/ci/catalog/resource_type.rb +++ b/ee/app/graphql/types/ci/catalog/resource_type.rb @@ -7,7 +7,7 @@ module Catalog class ResourceType < BaseObject graphql_name 'CiCatalogResource' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType field :id, GraphQL::Types::ID, null: false, description: 'ID of the catalog resource.', alpha: { milestone: '15.11' } diff --git a/ee/app/graphql/types/ci/code_quality_degradation_type.rb b/ee/app/graphql/types/ci/code_quality_degradation_type.rb index 24a65a4ada714..6c998cb82da4b 100644 --- a/ee/app/graphql/types/ci/code_quality_degradation_type.rb +++ b/ee/app/graphql/types/ci/code_quality_degradation_type.rb @@ -7,7 +7,7 @@ class CodeQualityDegradationType < BaseObject graphql_name 'CodeQualityDegradation' description 'Represents a code quality degradation on the pipeline.' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType alias_method :degradation, :object diff --git a/ee/app/graphql/types/dast/profile_type.rb b/ee/app/graphql/types/dast/profile_type.rb index 648f6ac679d63..2d4d372e65ef4 100644 --- a/ee/app/graphql/types/dast/profile_type.rb +++ b/ee/app/graphql/types/dast/profile_type.rb @@ -6,7 +6,7 @@ class ProfileType < BaseObject graphql_name 'DastProfile' description 'Represents a DAST Profile' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType authorize :read_on_demand_dast_scan diff --git a/ee/app/graphql/types/epic_type.rb b/ee/app/graphql/types/epic_type.rb index 3fcd39476ccbe..5b5a2dc2b82f0 100644 --- a/ee/app/graphql/types/epic_type.rb +++ b/ee/app/graphql/types/epic_type.rb @@ -5,7 +5,7 @@ class EpicType < BaseObject graphql_name 'Epic' description 'Represents an epic' - connection_type_class(Types::CountableConnectionType) + connection_type_class Types::CountableConnectionType include ::Gitlab::Graphql::Aggregations::Epics::Constants -- GitLab