Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

remove query projection remains

ulferts4fcbced20057
diff --git a/app/models/queries/queries.rb b/app/models/queries/queries.rb
index ec878751106..20e34d96c6f 100644
--- a/app/models/queries/queries.rb
+++ b/app/models/queries/queries.rb
@@ -42,5 +42,4 @@ module Queries::Queries
register.filter query_ns, filters_ns::HiddenFilter
register.filter query_ns, filters_ns::UpdatedAtFilter
register.filter query_ns, filters_ns::IdFilter
- register.filter query_ns, filters_ns::ModuleIdentifierFilter
end
diff --git a/app/models/queries/queries/filters/module_identifier_filter.rb b/app/models/queries/queries/filters/module_identifier_filter.rb
deleted file mode 100644
index 45e0ebe8fc3..00000000000
--- a/app/models/queries/queries/filters/module_identifier_filter.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#-- encoding: UTF-8
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2021 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::Queries::Filters::ModuleIdentifierFilter < Queries::Queries::Filters::QueryFilter
- def type
- :list_optional
- end
-
- def self.key
- :module_identifier
- end
-
- def where
- operator_strategy.sql_for_field(values, 'queries', 'projections')
- end
-
- def allowed_values
- [['Work packages', 'work_packages'], ['Calendar', 'calendar'], ['BIM', 'bim']]
- end
-end
diff --git a/spec/models/queries/queries/filters/module_identifier_filter_spec.rb b/spec/models/queries/queries/filters/module_identifier_filter_spec.rb
deleted file mode 100644
index 046d7fbbeeb..00000000000
--- a/spec/models/queries/queries/filters/module_identifier_filter_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-#-- encoding: UTF-8
-
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2021 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 'spec_helper'
-
-describe Queries::Queries::Filters::ModuleIdentifierFilter, type: :model do
- it_behaves_like 'basic query filter' do
- let(:class_key) { :module_identifier }
- let(:type) { :list_optional }
- end
-
- it_behaves_like 'list_optional query filter' do
- let(:attribute) { :module_identifier }
- let(:model) { Query }
- let(:valid_values) { ['calendar'] }
- end
-end
diff --git a/spec/requests/api/v3/queries/create_query_spec.rb b/spec/requests/api/v3/queries/create_query_spec.rb
index d5bf5aec4ce..57ccaf82420 100644
--- a/spec/requests/api/v3/queries/create_query_spec.rb
+++ b/spec/requests/api/v3/queries/create_query_spec.rb
@@ -130,27 +130,6 @@ describe "POST /api/v3/queries", type: :request do
expect(filter.operator).to eq "="
expect(filter.values).to eq [status.id.to_s]
end
-
- context 'with a module specific projection' do
- let(:params) do
- default_params.merge(
- projections: [
- {
- _type: "calendar",
- options: {}
- }
- ]
- )
- end
-
- it 'creates the Query successfully' do
- query = Query.find_by(name: params[:name])
- json = JSON.parse(last_response.body)
-
- expect(query).to be_present
- expect(json["projections"][0]["_type"]).to eq "calendar"
- end
- end
end
context "with invalid parameters" do
diff --git a/spec/requests/api/v3/queries/query_resource_spec.rb b/spec/requests/api/v3/queries/query_resource_spec.rb
index 840723c8572..1c5d4de7519 100644
--- a/spec/requests/api/v3/queries/query_resource_spec.rb
+++ b/spec/requests/api/v3/queries/query_resource_spec.rb
@@ -204,32 +204,6 @@ describe 'API v3 Query resource', type: :request, content_type: :json do
.at_path("_embedded/elements/0/name")
end
end
-
- context 'with filters for module' do
- let(:module_identifier) { "calendar" }
- let(:path) do
- filter = [module_identifier: { operator: "=", values: [module_identifier] }]
-
- api_v3_paths.path_for(:queries, filters: filter)
- end
- let(:query) { FactoryBot.create(:public_query, project: project, projections: [{ _type: "calendar" }]) }
-
- let(:prepare) do
- query
- end
-
- it 'includes only queries with projections for the specified module' do
- expect(last_response.body)
- .to be_json_eql(1)
- .at_path("count")
- expect(last_response.body)
- .to be_json_eql(1)
- .at_path("total")
- expect(last_response.body)
- .to be_json_eql(query.name.to_json)
- .at_path("_embedded/elements/0/name")
- end
- end
end
describe '#get queries/:id' do