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
add eager loading to time entries api
ulfertsed32a4969ca3
diff --git a/modules/costs/lib/api/v3/time_entries/time_entries_api.rb b/modules/costs/lib/api/v3/time_entries/time_entries_api.rbindex fd00be14d2d..a437253e5c9 100644--- a/modules/costs/lib/api/v3/time_entries/time_entries_api.rb+++ b/modules/costs/lib/api/v3/time_entries/time_entries_api.rb@@ -33,7 +33,9 @@ module APIhelpers ::API::Utilities::UrlPropsParsingHelperresources :time_entries do- get &::API::V3::Utilities::Endpoints::Index.new(model: TimeEntry).mount+ get &::API::V3::Utilities::Endpoints::Index.new(model: TimeEntry,+ scope: -> { TimeEntry.includes(TimeEntryRepresenter.to_eager_load) })+ .mountpost &::API::V3::Utilities::Endpoints::Create.new(model: TimeEntry).mountmount ::API::V3::TimeEntries::CreateFormAPIdiff --git a/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb b/modules/costs/lib/api/v3/time_entries/time_entry_representer.rbindex 37dd5d63ea9..cc3e64369b5 100644--- a/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb+++ b/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb@@ -132,6 +132,11 @@ module API'hours',allow_nil: true)end++ self.to_eager_load = [:work_package,+ :user,+ :activity,+ { project: :enabled_modules }]endendend