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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#42551] API: Add Storages to collection endpoint of projects
Andreas Pfohlcebc05b3e57f
diff --git a/lib/api/v3/projects/project_eager_loading_wrapper.rb b/lib/api/v3/projects/project_eager_loading_wrapper.rbindex b651bc28235..4a27c73ec50 100644--- a/lib/api/v3/projects/project_eager_loading_wrapper.rb+++ b/lib/api/v3/projects/project_eager_loading_wrapper.rb@@ -32,6 +32,9 @@ module APIclass ProjectEagerLoadingWrapper < API::V3::Utilities::EagerLoading::EagerLoadingWrapperinclude API::V3::Utilities::EagerLoading::CustomFieldAccessor+ # delegate class check to wrapped object, as there are cases where the type is checked explicitly.+ delegate :is_a?, to: :__getobj__+class << selfdef wrap(projects)custom_fields = projects.first.available_custom_fields if projects.present?diff --git a/spec/requests/api/v3/projects/index_resource_spec.rb b/spec/requests/api/v3/projects/index_resource_spec.rbindex b09660939a3..bf0774e655c 100644--- a/spec/requests/api/v3/projects/index_resource_spec.rb+++ b/spec/requests/api/v3/projects/index_resource_spec.rb@@ -266,4 +266,17 @@ describe 'API v3 Project resource index', type: :request, content_type: :json do.to be_json_eql(expected.to_json)endend++ context 'as project collection' do+ let(:role) { create(:role, permissions: %i[view_work_packages]) }+ let(:projects) { [project] }+ let(:expected) do+ "#{api_v3_paths.project(project.id)}/work_packages"+ end++ it 'has projects with links to their work packages' do+ expect(last_response.body)+ .to be_json_eql(expected.to_json).at_path('_embedded/elements/0/_links/workPackages/href')+ end+ endend