2020-07-30 14:09:39 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Resolvers
|
2020-08-10 14:09:54 -04:00
|
|
|
class ProjectMilestonesResolver < MilestonesResolver
|
2020-07-30 14:09:39 -04:00
|
|
|
argument :include_ancestors, GraphQL::BOOLEAN_TYPE,
|
2020-08-10 14:09:54 -04:00
|
|
|
required: false,
|
|
|
|
description: "Also return milestones in the project's parent group and its ancestors"
|
2020-07-30 14:09:39 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def parent_id_parameters(args)
|
|
|
|
return { project_ids: parent.id } unless args[:include_ancestors].present? && parent.group.present?
|
|
|
|
|
|
|
|
{
|
|
|
|
group_ids: parent.group.self_and_ancestors.select(:id),
|
|
|
|
project_ids: parent.id
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|