Commit eb8a3ed7 authored by Robert Speicher's avatar Robert Speicher

Merge branch '329243-add-description-rollover-iteration-cadences' into 'master'

Add description and roll_over to IterationsCadences

See merge request gitlab-org/gitlab!60436
parents 46c8347a 40a5280a
---
title: Add description and roll_over columns to iterations_cadences
merge_request: 60436
author:
type: added
# frozen_string_literal: true
class AddDescriptionRollOverToIterationsCadences < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
def up
with_lock_retries do
add_column :iterations_cadences, :roll_over, :boolean, null: false, default: false
add_column :iterations_cadences, :description, :text # rubocop:disable Migration/AddLimitToTextColumns
end
end
def down
with_lock_retries do
remove_column :iterations_cadences, :roll_over
remove_column :iterations_cadences, :description
end
end
end
# frozen_string_literal: true
class AddTextLimitToIterationsCadencesDescription < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
def up
add_text_limit :iterations_cadences, :description, 5000
end
def down
remove_text_limit :iterations_cadences, :description
end
end
0a7bf3fe10a5eca94392a599d0736c881065a0b2c33bb383c0b91eb5ac453db9
\ No newline at end of file
7e90e64df39205c79a67acc311cd58dd9b55d2b3919d58749e3253854f99a44a
\ No newline at end of file
......@@ -13993,6 +13993,9 @@ CREATE TABLE iterations_cadences (
active boolean DEFAULT true NOT NULL,
automatic boolean DEFAULT true NOT NULL,
title text NOT NULL,
roll_over boolean DEFAULT false NOT NULL,
description text,
CONSTRAINT check_5c5d2b44bd CHECK ((char_length(description) <= 5000)),
CONSTRAINT check_fedff82d3b CHECK ((char_length(title) <= 255))
);
......@@ -2498,9 +2498,11 @@ Input type: `IterationCadenceCreateInput`
| <a id="mutationiterationcadencecreateactive"></a>`active` | [`Boolean!`](#boolean) | Whether the iteration cadence is active. |
| <a id="mutationiterationcadencecreateautomatic"></a>`automatic` | [`Boolean!`](#boolean) | Whether the iteration cadence should automatically generate future iterations. |
| <a id="mutationiterationcadencecreateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationiterationcadencecreatedescription"></a>`description` | [`String`](#string) | Description of the iteration cadence. Maximum length is 5000 characters. |
| <a id="mutationiterationcadencecreatedurationinweeks"></a>`durationInWeeks` | [`Int`](#int) | Duration in weeks of the iterations within this cadence. |
| <a id="mutationiterationcadencecreategrouppath"></a>`groupPath` | [`ID!`](#id) | The group where the iteration cadence is created. |
| <a id="mutationiterationcadencecreateiterationsinadvance"></a>`iterationsInAdvance` | [`Int`](#int) | Future iterations to be created when iteration cadence is set to automatic. |
| <a id="mutationiterationcadencecreaterollover"></a>`rollOver` | [`Boolean`](#boolean) | Whether the iteration cadence should roll over issues to the next iteration or not. |
| <a id="mutationiterationcadencecreatestartdate"></a>`startDate` | [`Time`](#time) | Timestamp of the iteration cadence start date. |
| <a id="mutationiterationcadencecreatetitle"></a>`title` | [`String`](#string) | Title of the iteration cadence. |
......@@ -2542,9 +2544,11 @@ Input type: `IterationCadenceUpdateInput`
| <a id="mutationiterationcadenceupdateactive"></a>`active` | [`Boolean`](#boolean) | Whether the iteration cadence is active. |
| <a id="mutationiterationcadenceupdateautomatic"></a>`automatic` | [`Boolean`](#boolean) | Whether the iteration cadence should automatically generate future iterations. |
| <a id="mutationiterationcadenceupdateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. |
| <a id="mutationiterationcadenceupdatedescription"></a>`description` | [`String`](#string) | Description of the iteration cadence. Maximum length is 5000 characters. |
| <a id="mutationiterationcadenceupdatedurationinweeks"></a>`durationInWeeks` | [`Int`](#int) | Duration in weeks of the iterations within this cadence. |
| <a id="mutationiterationcadenceupdateid"></a>`id` | [`IterationsCadenceID!`](#iterationscadenceid) | Global ID of the iteration cadence. |
| <a id="mutationiterationcadenceupdateiterationsinadvance"></a>`iterationsInAdvance` | [`Int`](#int) | Future iterations to be created when iteration cadence is set to automatic. |
| <a id="mutationiterationcadenceupdaterollover"></a>`rollOver` | [`Boolean`](#boolean) | Whether the iteration cadence should roll over issues to the next iteration or not. |
| <a id="mutationiterationcadenceupdatestartdate"></a>`startDate` | [`Time`](#time) | Timestamp of the iteration cadence start date. |
| <a id="mutationiterationcadenceupdatetitle"></a>`title` | [`String`](#string) | Title of the iteration cadence. |
......@@ -9431,9 +9435,11 @@ Represents an iteration cadence.
| ---- | ---- | ----------- |
| <a id="iterationcadenceactive"></a>`active` | [`Boolean`](#boolean) | Whether the iteration cadence is active. |
| <a id="iterationcadenceautomatic"></a>`automatic` | [`Boolean`](#boolean) | Whether the iteration cadence should automatically generate future iterations. |
| <a id="iterationcadencedescription"></a>`description` | [`String`](#string) | Description of the iteration cadence. Maximum length is 5000 characters. |
| <a id="iterationcadencedurationinweeks"></a>`durationInWeeks` | [`Int`](#int) | Duration in weeks of the iterations within this cadence. |
| <a id="iterationcadenceid"></a>`id` | [`IterationsCadenceID!`](#iterationscadenceid) | Global ID of the iteration cadence. |
| <a id="iterationcadenceiterationsinadvance"></a>`iterationsInAdvance` | [`Int`](#int) | Future iterations to be created when iteration cadence is set to automatic. |
| <a id="iterationcadencerollover"></a>`rollOver` | [`Boolean!`](#boolean) | Whether the iteration cadence should roll over issues to the next iteration or not. |
| <a id="iterationcadencestartdate"></a>`startDate` | [`Time`](#time) | Timestamp of the iteration cadence start date. |
| <a id="iterationcadencetitle"></a>`title` | [`String!`](#string) | Title of the iteration cadence. |
......
......@@ -31,6 +31,12 @@ module Mutations
argument :active, GraphQL::BOOLEAN_TYPE, required: true,
description: copy_field_description(Types::Iterations::CadenceType, :active)
argument :roll_over, GraphQL::BOOLEAN_TYPE, required: false,
description: copy_field_description(Types::Iterations::CadenceType, :roll_over)
argument :description, GraphQL::STRING_TYPE, required: false,
description: copy_field_description(Types::Iterations::CadenceType, :description)
field :iteration_cadence, Types::Iterations::CadenceType, null: true,
description: 'The created iteration cadence.'
......
......@@ -29,6 +29,12 @@ module Mutations
argument :active, GraphQL::BOOLEAN_TYPE, required: false,
description: copy_field_description(Types::Iterations::CadenceType, :active)
argument :roll_over, GraphQL::BOOLEAN_TYPE, required: false,
description: copy_field_description(Types::Iterations::CadenceType, :roll_over)
argument :description, GraphQL::STRING_TYPE, required: false,
description: copy_field_description(Types::Iterations::CadenceType, :description)
field :iteration_cadence, Types::Iterations::CadenceType, null: true,
description: 'The updated iteration cadence.'
......
......@@ -28,6 +28,12 @@ module Types
field :active, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Whether the iteration cadence is active.'
field :roll_over, GraphQL::BOOLEAN_TYPE, null: false,
description: 'Whether the iteration cadence should roll over issues to the next iteration or not.'
field :description, GraphQL::STRING_TYPE, null: true,
description: 'Description of the iteration cadence. Maximum length is 5000 characters.'
end
end
end
......@@ -16,6 +16,7 @@ module Iterations
validates :iterations_in_advance, presence: true
validates :active, inclusion: [true, false]
validates :automatic, inclusion: [true, false]
validates :description, length: { maximum: 5000 }
scope :with_groups, -> (group_ids) { where(group_id: group_ids) }
scope :with_duration, -> (duration) { where(duration_in_weeks: duration) }
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['IterationCadence'] do
let(:fields) do
%i[id title duration_in_weeks iterations_in_advance start_date automatic active]
%i[id title duration_in_weeks iterations_in_advance start_date automatic active roll_over description]
end
specify { expect(described_class.graphql_name).to eq('IterationCadence') }
......
......@@ -18,5 +18,6 @@ RSpec.describe ::Iterations::Cadence do
it { is_expected.to validate_presence_of(:group_id) }
it { is_expected.not_to allow_value(nil).for(:active) }
it { is_expected.not_to allow_value(nil).for(:automatic) }
it { is_expected.to validate_length_of(:description).is_at_most(5000) }
end
end
......@@ -16,7 +16,9 @@ RSpec.describe 'Creating an iteration cadence' do
duration_in_weeks: 1,
iterations_in_advance: 1,
automatic: false,
active: false
active: false,
roll_over: true,
description: 'Iteration cadence description'
}
end
......
......@@ -9,6 +9,7 @@ RSpec.describe 'Updating an iteration cadence' do
let_it_be(:group) { create(:group) }
let_it_be(:iteration_cadence, refind: true) { create(:iterations_cadence, group: group) }
let(:description) { 'updated cadence description' }
let(:start_date) { Time.now.strftime('%F') }
let(:attributes) do
{
......@@ -17,7 +18,9 @@ RSpec.describe 'Updating an iteration cadence' do
duration_in_weeks: 1,
iterations_in_advance: 1,
automatic: false,
active: false
active: false,
roll_over: true,
description: description
}
end
......@@ -79,6 +82,8 @@ RSpec.describe 'Updating an iteration cadence' do
expect(iteration_cadence_hash['iterationsInAdvance']).to eq(1)
expect(iteration_cadence_hash['automatic']).to eq(false)
expect(iteration_cadence_hash['active']).to eq(false)
expect(iteration_cadence_hash['rollOver']).to eq(true)
expect(iteration_cadence_hash['description']).to eq(description)
iteration_cadence.reload
expect(iteration_cadence.title).to eq('title')
......@@ -87,6 +92,8 @@ RSpec.describe 'Updating an iteration cadence' do
expect(iteration_cadence.iterations_in_advance).to eq(1)
expect(iteration_cadence.automatic).to eq(false)
expect(iteration_cadence.active).to eq(false)
expect(iteration_cadence.roll_over).to eq(true)
expect(iteration_cadence.description).to eq(description)
end
context 'when iteration_cadences feature flag is disabled' do
......
......@@ -21,7 +21,9 @@ RSpec.describe Iterations::Cadences::CreateService do
title: 'My iteration cadence',
start_date: Time.current.to_s,
duration_in_weeks: 1,
iterations_in_advance: 1
iterations_in_advance: 1,
roll_over: true,
description: 'Iteration cadence description'
}
end
......
......@@ -14,7 +14,9 @@ RSpec.describe Iterations::Cadences::UpdateService do
title: 'Updated iteration cadence',
start_date: 2.days.from_now.to_s,
duration_in_weeks: 4,
iterations_in_advance: 5
iterations_in_advance: 5,
roll_over: true,
description: 'updated cadence description'
}
end
......@@ -64,6 +66,10 @@ RSpec.describe Iterations::Cadences::UpdateService do
change(iteration_cadence, :duration_in_weeks).to(4)
).and(
change(iteration_cadence, :iterations_in_advance).to(5)
).and(
change(iteration_cadence, :roll_over).from(false).to(true)
).and(
change(iteration_cadence, :description).to('updated cadence description')
)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment