diff --git a/doc/api/graphql/reference/_index.md b/doc/api/graphql/reference/_index.md index 68328ff3ef89f82faaa3ad34b94de04f32b4dd99..6592c05b70b1efedaff85d216fd65be3664fdabf 100644 --- a/doc/api/graphql/reference/_index.md +++ b/doc/api/graphql/reference/_index.md @@ -8517,6 +8517,7 @@ Input type: `LifecycleUpdateInput` | `id` | [`WorkItemsStatusesLifecycleID!`](#workitemsstatuseslifecycleid) | Global ID of the lifecycle to be updated. | | `name` | [`String`](#string) | Name of the lifecycle. | | `namespacePath` | [`ID!`](#id) | Namespace path where the lifecycle exists. | +| `statusMappings` | [`[StatusMappingInput!]`](#statusmappinginput) | Mappings for statuses being removed from the lifecycle. Maps old status to replacement status. | | `statuses` | [`[WorkItemStatusInput!]`](#workitemstatusinput) | Statuses of the lifecycle. Can be existing (with id) or new (without id). | #### Fields @@ -54124,6 +54125,17 @@ Represents an action to perform over a snippet file. | `filePath` | [`String!`](#string) | Path of the snippet file. | | `previousPath` | [`String`](#string) | Previous path of the snippet file. | +### `StatusMappingInput` + +Input for mapping a removed status to a replacement status. + +#### Arguments + +| Name | Type | Description | +| ---- | ---- | ----------- | +| `newStatusId` | [`GlobalID!`](#globalid) | Global ID of the replacement status. | +| `oldStatusId` | [`GlobalID!`](#globalid) | Global ID of the status being removed/replaced. | + ### `Timeframe` A time-frame defined as a closed inclusive range of two dates. diff --git a/ee/app/graphql/mutations/work_items/lifecycles/update.rb b/ee/app/graphql/mutations/work_items/lifecycles/update.rb index f5d0fc1f2e3109f055506403987721b3f0225a2a..e08a138f26d56e3249df3b1fb47b0f70805b6d9f 100644 --- a/ee/app/graphql/mutations/work_items/lifecycles/update.rb +++ b/ee/app/graphql/mutations/work_items/lifecycles/update.rb @@ -42,6 +42,10 @@ class Update < BaseMutation required: false, description: 'Index of the default duplicated status in the statuses array.' + argument :status_mappings, [Types::WorkItems::StatusMappingInputType], + required: false, + description: 'Mappings for statuses being removed from the lifecycle. Maps old status to replacement status.' + def resolve(namespace_path:, **args) group = authorized_find!(namespace_path: namespace_path) diff --git a/ee/app/graphql/types/work_items/status_mapping_input_type.rb b/ee/app/graphql/types/work_items/status_mapping_input_type.rb new file mode 100644 index 0000000000000000000000000000000000000000..5d649ff53786e05eb5345d11a654061e1826e9ea --- /dev/null +++ b/ee/app/graphql/types/work_items/status_mapping_input_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Types + module WorkItems + class StatusMappingInputType < BaseInputObject + graphql_name 'StatusMappingInput' + + description 'Input for mapping a removed status to a replacement status' + + argument :old_status_id, ::Types::GlobalIDType, + required: true, + description: 'Global ID of the status being removed/replaced.' + + argument :new_status_id, ::Types::GlobalIDType, + required: true, + description: 'Global ID of the replacement status.' + end + end +end diff --git a/ee/spec/graphql/types/work_items/status_mapping_input_type_spec.rb b/ee/spec/graphql/types/work_items/status_mapping_input_type_spec.rb new file mode 100644 index 0000000000000000000000000000000000000000..29f8b51bcdba2c442195d6b8231a29de55aaddeb --- /dev/null +++ b/ee/spec/graphql/types/work_items/status_mapping_input_type_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe ::Types::WorkItems::StatusMappingInputType, feature_category: :team_planning do + let(:fields) do + %i[oldStatusId newStatusId] + end + + specify { expect(described_class).to have_graphql_fields(fields) } + + specify { expect(described_class.graphql_name).to eq('StatusMappingInput') } +end