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

employ endpoint for projects#show

ulferts0d086a5e5d4a
diff --git a/modules/bcf/app/controllers/bcf/api/v2_1/endpoints/show.rb b/modules/bcf/app/controllers/bcf/api/v2_1/endpoints/show.rb
new file mode 100644
index 00000000000..78b48e4a377
--- /dev/null
+++ b/modules/bcf/app/controllers/bcf/api/v2_1/endpoints/show.rb
@@ -0,0 +1,44 @@
+#-- encoding: UTF-8
+
+#-- copyright
+# OpenProject is a project management system.
+# Copyright (C) 2012-2018 the OpenProject Foundation (OPF)
+#
+# 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-2017 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 docs/COPYRIGHT.rdoc for more details.
+#++
+
+module Bcf::API::V2_1::Endpoints
+ class Show < API::Utilities::Endpoints::Show
+ def render(instance)
+ render_representer
+ .new(instance)
+ end
+
+ private
+
+ def deduce_render_representer
+ "::Bcf::API::V2_1::#{deduce_api_namespace}::SingleRepresenter".constantize
+ end
+ end
+end
diff --git a/modules/bcf/app/controllers/bcf/api/v2_1/projects_api.rb b/modules/bcf/app/controllers/bcf/api/v2_1/projects_api.rb
index f3d47021cb3..cff194540a2 100644
--- a/modules/bcf/app/controllers/bcf/api/v2_1/projects_api.rb
+++ b/modules/bcf/app/controllers/bcf/api/v2_1/projects_api.rb
@@ -53,11 +53,7 @@ module Bcf::API::V2_1
.find(params[:id])
end
- get do
- Bcf::API::V2_1::Projects::SingleRepresenter
- .new(@project)
- end
-
+ get &::Bcf::API::V2_1::Endpoints::Show.new(model: Project).mount
put &::Bcf::API::V2_1::Endpoints::Update.new(model: Project).mount
end
end