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

[#47049] Added links to ProjectStorages from Projects and Storages

Andreas Pfohl20c0268b141e
diff --git a/lib/api/v3/projects/project_representer.rb b/lib/api/v3/projects/project_representer.rb
index 81a6122b178..c5e6a34020b 100644
--- a/lib/api/v3/projects/project_representer.rb
+++ b/lib/api/v3/projects/project_representer.rb
@@ -182,6 +182,10 @@ module API
end
end
+ link :projectStorages, uncacheable: true do
+ { href: "#{api_v3_paths.project_storages}?filters=[{\"projectId\":{\"operator\":\"=\",\"values\":[\"#{represented.id}\"]}}]" }
+ end
+
associated_resource :parent,
v3_path: :project,
representer: ::API::V3::Projects::ProjectRepresenter,
diff --git a/modules/storages/lib/api/v3/storages/storage_representer.rb b/modules/storages/lib/api/v3/storages/storage_representer.rb
index 585a414647f..296dfa10aae 100644
--- a/modules/storages/lib/api/v3/storages/storage_representer.rb
+++ b/modules/storages/lib/api/v3/storages/storage_representer.rb
@@ -148,6 +148,10 @@ module API::V3::Storages
{ href: @connection_manager.get_authorization_uri, title: 'Authorize' }
end
+ link :projectStorages do
+ { href: "#{api_v3_paths.project_storages}?filters=[{\"storageId\":{\"operator\":\"=\",\"values\":[\"#{represented.id}\"]}}]" }
+ end
+
associated_resource :oauth_application,
skip_render: ->(*) { !current_user.admin? },
getter: ->(*) {