Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export function initializeCoreDisplayFields(displayFieldService:DisplayFieldServ
'TimeEntriesActivity',
'Version',
'Category',
'BacklogBucket',
'Sprint',
'CustomField::Hierarchy::Item',
'CustomOption',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export function initializeCoreEditFields(editFieldService:EditFieldService, sele
'Version',
'TimeEntriesActivity',
'Category',
'BacklogBucket',
'Sprint',
'CustomOption',
'CustomField::Hierarchy::Item',
Expand Down
35 changes: 35 additions & 0 deletions modules/backlogs/app/models/queries/backlog_buckets.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module Queries::BacklogBuckets
::Queries::Register.register(BacklogBucketQuery) do
order Orders::DefaultOrder
Comment thread
toy marked this conversation as resolved.
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module Queries
module BacklogBuckets
class BacklogBucketQuery
include ::Queries::BaseQuery
include ::Queries::UnpersistedQuery

def self.model
::BacklogBucket
end

def default_scope
::BacklogBucket.visible(User.current)
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

class Queries::BacklogBuckets::Orders::DefaultOrder < Queries::Orders::Base
self.model = BacklogBucket

def self.key
/\A(id|name)\z/
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module API
module V3
module BacklogBuckets
class BacklogBucketCollectionRepresenter < ::API::Decorators::OffsetPaginatedCollection
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

require "roar/decorator"
require "roar/json/hal"

module API
module V3
module BacklogBuckets
class BacklogBucketRepresenter < ::API::Decorators::Single
include API::Decorators::LinkedResource

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to PR - this should be automatically included by API::V3::Workspaces::LinkedResource

https://community.openproject.org/wp/AGILE-282

include API::V3::Workspaces::LinkedResource
include API::Decorators::DateProperty

self_link

associated_project as: :definingWorkspace

property :id,
render_nil: true

property :name,
render_nil: true

date_time_property :created_at
date_time_property :updated_at

def _type
"BacklogBucket"
end
end
end
end
end
51 changes: 51 additions & 0 deletions modules/backlogs/lib/api/v3/backlog_buckets/backlog_buckets_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# frozen_string_literal: true

#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

module API
module V3
module BacklogBuckets
class BacklogBucketsAPI < ::API::OpenProjectAPI
resources :backlog_buckets do
get &::API::V3::Utilities::Endpoints::Index
.new(model: BacklogBucket)
.mount

route_param :id, type: Integer, desc: "Backlog Bucket ID" do
after_validation do
@backlog_bucket = BacklogBucket.visible(current_user).find(params[:id])
end

get &::API::V3::Utilities::Endpoints::Show.new(model: BacklogBucket).mount
end
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true

# -- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
# ++

module API
module V3
module BacklogBuckets
class BacklogBucketsByProjectAPI < ::API::OpenProjectAPI
resources :backlog_buckets do
after_validation do
authorize_in_project(:view_sprints, project: @project)
end

get &::API::V3::Utilities::Endpoints::Index
.new(
model: BacklogBucket,
scope: -> { BacklogBucket.where(project: @project).visible.order_alphabetically }
)
.mount
end
end
end
end
end
17 changes: 16 additions & 1 deletion modules/backlogs/lib/open_project/backlogs/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,26 @@ def self.settings
"#{root}/projects/#{id}/sprints"
end

add_api_path :backlog_buckets do
"#{root}/backlog_buckets"
end

add_api_path :backlog_bucket do |id|
"#{root}/backlog_buckets/#{id}"
end

add_api_path :project_backlog_buckets do |id|
"#{root}/projects/#{id}/backlog_buckets"
end

add_api_endpoint "API::V3::Root" do
mount ::API::V3::Sprints::SprintsAPI
mount ::API::V3::BacklogBuckets::BacklogBucketsAPI
end

add_api_endpoint "API::V3::Projects::ProjectsAPI", :id do
mount ::API::V3::Sprints::SprintsByProjectAPI
mount ::API::V3::BacklogBuckets::BacklogBucketsByProjectAPI
end

initializer "openproject_backlogs.event_subscriptions" do
Expand Down Expand Up @@ -220,13 +234,14 @@ def self.settings
end

config.to_prepare do
%i[position story_points sprint].each do |attribute|
%i[position story_points sprint backlog_bucket].each do |attribute|
::Type.add_constraint attribute, ->(_type, project: nil) { project.nil? || project.backlogs_enabled? }
end

::Type.add_default_mapping(:estimates_and_progress, :story_points)
::Type.add_default_mapping(:other, :position)
::Type.add_default_mapping(:details, :sprint)
::Type.add_default_mapping(:details, :backlog_bucket)

::Queries::Register.register(::Query) do
filter Queries::WorkPackages::Filter::SprintFilter
Expand Down
Loading
Loading