Commit a399b0a2 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Rename milestone collection resolvers to plural

Since these return a collection of milestones, we pluralize the name.
We do this since we'll be adding another resolver for single
milestones.
parent 90c70427
# frozen_string_literal: true # frozen_string_literal: true
module Resolvers module Resolvers
class GroupMilestoneResolver < MilestoneResolver class GroupMilestonesResolver < MilestonesResolver
argument :include_descendants, GraphQL::BOOLEAN_TYPE, argument :include_descendants, GraphQL::BOOLEAN_TYPE,
required: false, required: false,
description: 'Also return milestones in all subgroups and subprojects' description: 'Also return milestones in all subgroups and subprojects'
private private
......
# frozen_string_literal: true # frozen_string_literal: true
module Resolvers module Resolvers
class MilestoneResolver < BaseResolver class MilestonesResolver < BaseResolver
include Gitlab::Graphql::Authorize::AuthorizeResource include Gitlab::Graphql::Authorize::AuthorizeResource
include TimeFrameArguments include TimeFrameArguments
argument :ids, [GraphQL::ID_TYPE], argument :ids, [GraphQL::ID_TYPE],
required: false, required: false,
description: 'Array of global milestone IDs, e.g., "gid://gitlab/Milestone/1"' description: 'Array of global milestone IDs, e.g., "gid://gitlab/Milestone/1"'
argument :state, Types::MilestoneStateEnum, argument :state, Types::MilestoneStateEnum,
required: false, required: false,
description: 'Filter milestones by state' description: 'Filter milestones by state'
type Types::MilestoneType, null: true type Types::MilestoneType, null: true
...@@ -35,7 +35,7 @@ module Resolvers ...@@ -35,7 +35,7 @@ module Resolvers
end end
def parent def parent
@parent ||= object.respond_to?(:sync) ? object.sync : object synchronized_object
end end
def parent_id_parameters(args) def parent_id_parameters(args)
......
# frozen_string_literal: true # frozen_string_literal: true
module Resolvers module Resolvers
class ProjectMilestoneResolver < MilestoneResolver class ProjectMilestonesResolver < MilestonesResolver
argument :include_ancestors, GraphQL::BOOLEAN_TYPE, argument :include_ancestors, GraphQL::BOOLEAN_TYPE,
required: false, required: false,
description: "Also return milestones in the project's parent group and its ancestors" description: "Also return milestones in the project's parent group and its ancestors"
private private
......
...@@ -51,7 +51,7 @@ module Types ...@@ -51,7 +51,7 @@ module Types
field :milestones, Types::MilestoneType.connection_type, null: true, field :milestones, Types::MilestoneType.connection_type, null: true,
description: 'Milestones of the group', description: 'Milestones of the group',
resolver: Resolvers::GroupMilestoneResolver resolver: Resolvers::GroupMilestonesResolver
field :boards, field :boards,
Types::BoardType.connection_type, Types::BoardType.connection_type,
......
...@@ -150,7 +150,7 @@ module Types ...@@ -150,7 +150,7 @@ module Types
field :milestones, Types::MilestoneType.connection_type, null: true, field :milestones, Types::MilestoneType.connection_type, null: true,
description: 'Milestones of the project', description: 'Milestones of the project',
resolver: Resolvers::ProjectMilestoneResolver resolver: Resolvers::ProjectMilestonesResolver
field :project_members, field :project_members,
Types::ProjectMemberType.connection_type, Types::ProjectMemberType.connection_type,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Resolvers::GroupMilestoneResolver do RSpec.describe Resolvers::GroupMilestonesResolver do
include GraphqlHelpers include GraphqlHelpers
describe '#resolve' do describe '#resolve' do
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Resolvers::ProjectMilestoneResolver do RSpec.describe Resolvers::ProjectMilestonesResolver do
include GraphqlHelpers include GraphqlHelpers
describe '#resolve' do describe '#resolve' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment