2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module MergeRequests
|
|
|
|
class SetMilestone < Base
|
|
|
|
graphql_name 'MergeRequestSetMilestone'
|
|
|
|
|
|
|
|
argument :milestone_id,
|
2021-01-03 14:25:43 +05:30
|
|
|
::Types::GlobalIDType[::Milestone],
|
2019-12-26 22:10:19 +05:30
|
|
|
required: false,
|
|
|
|
loads: Types::MilestoneType,
|
|
|
|
description: <<~DESC
|
2021-10-27 15:23:28 +05:30
|
|
|
Milestone to assign to the merge request.
|
2019-12-26 22:10:19 +05:30
|
|
|
DESC
|
|
|
|
|
|
|
|
def resolve(project_path:, iid:, milestone: nil)
|
|
|
|
merge_request = authorized_find!(project_path: project_path, iid: iid)
|
|
|
|
project = merge_request.project
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
::MergeRequests::UpdateService.new(project: project, current_user: current_user, params: { milestone_id: milestone&.id })
|
2019-12-26 22:10:19 +05:30
|
|
|
.execute(merge_request)
|
|
|
|
|
|
|
|
{
|
|
|
|
merge_request: merge_request,
|
2020-06-23 00:09:42 +05:30
|
|
|
errors: errors_on_object(merge_request)
|
2019-12-26 22:10:19 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|