2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Mutations
|
|
|
|
module Issues
|
|
|
|
class Update < Base
|
|
|
|
graphql_name 'UpdateIssue'
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
include CommonMutationArguments
|
2020-04-08 14:13:33 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
argument :title, GraphQL::STRING_TYPE,
|
2020-04-08 14:13:33 +05:30
|
|
|
required: false,
|
2021-01-03 14:25:43 +05:30
|
|
|
description: copy_field_description(Types::IssueType, :title)
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
argument :milestone_id, GraphQL::ID_TYPE, # rubocop: disable Graphql/IDType
|
2020-10-24 23:57:45 +05:30
|
|
|
required: false,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: 'The ID of the milestone to assign to the issue. On update milestone will be removed if set to null.'
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
argument :add_label_ids, [GraphQL::ID_TYPE],
|
2020-10-24 23:57:45 +05:30
|
|
|
required: false,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: 'The IDs of labels to be added to the issue.'
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
argument :remove_label_ids, [GraphQL::ID_TYPE],
|
2020-10-24 23:57:45 +05:30
|
|
|
required: false,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: 'The IDs of labels to be removed from the issue.'
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
argument :state_event, Types::IssueStateEventEnum,
|
2021-03-08 18:12:59 +05:30
|
|
|
description: 'Close or reopen an issue.',
|
2021-01-03 14:25:43 +05:30
|
|
|
required: false
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
def resolve(project_path:, iid:, **args)
|
|
|
|
issue = authorized_find!(project_path: project_path, iid: iid)
|
|
|
|
project = issue.project
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
::Issues::UpdateService.new(project: project, current_user: current_user, params: args).execute(issue)
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
{
|
|
|
|
issue: issue,
|
2020-06-23 00:09:42 +05:30
|
|
|
errors: errors_on_object(issue)
|
2020-03-13 15:44:24 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
Mutations::Issues::Update.prepend_mod_with('Mutations::Issues::Update')
|