summaryrefslogtreecommitdiff
path: root/app/graphql/types/work_items/convert_task_input_type.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-17 21:14:40 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-17 21:14:40 +0000
commit0c8b3354d966bf689a11736b80460fa5806b4495 (patch)
tree31259c03d4875aca416f422c912cc9b4d8a291a1 /app/graphql/types/work_items/convert_task_input_type.rb
parentae845b62778b7c82aae1828b5f237e0468993ef8 (diff)
downloadgitlab-ce-0c8b3354d966bf689a11736b80460fa5806b4495.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/types/work_items/convert_task_input_type.rb')
-rw-r--r--app/graphql/types/work_items/convert_task_input_type.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/app/graphql/types/work_items/convert_task_input_type.rb b/app/graphql/types/work_items/convert_task_input_type.rb
new file mode 100644
index 00000000000..1f142c6815c
--- /dev/null
+++ b/app/graphql/types/work_items/convert_task_input_type.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+module Types
+ module WorkItems
+ class ConvertTaskInputType < BaseInputObject
+ graphql_name 'WorkItemConvertTaskInput'
+
+ argument :line_number_end, GraphQL::Types::Int,
+ required: true,
+ description: 'Last line in the Markdown source that defines the list item task.'
+ argument :line_number_start, GraphQL::Types::Int,
+ required: true,
+ description: 'First line in the Markdown source that defines the list item task.'
+ argument :lock_version, GraphQL::Types::Int,
+ required: true,
+ description: 'Current lock version of the work item containing the task in the description.'
+ argument :title, GraphQL::Types::String,
+ required: true,
+ description: 'Full string of the task to be replaced. New title for the created work item.'
+ argument :work_item_type_id, ::Types::GlobalIDType[::WorkItems::Type],
+ required: true,
+ description: 'Global ID of the work item type used to create the new work item.',
+ prepare: ->(attribute, _ctx) { work_item_type_global_id(attribute) }
+
+ class << self
+ def work_item_type_global_id(global_id)
+ # TODO: remove this line when the compatibility layer is removed
+ # See: https://gitlab.com/gitlab-org/gitlab/-/issues/257883
+ global_id = ::Types::GlobalIDType[::WorkItems::Type].coerce_isolated_input(global_id)
+
+ global_id&.model_id
+ end
+ end
+ end
+ end
+end