diff options
Diffstat (limited to 'app/serializers/ci/dag_pipeline_entity.rb')
-rw-r--r-- | app/serializers/ci/dag_pipeline_entity.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/serializers/ci/dag_pipeline_entity.rb b/app/serializers/ci/dag_pipeline_entity.rb new file mode 100644 index 00000000000..b615dd2b194 --- /dev/null +++ b/app/serializers/ci/dag_pipeline_entity.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Ci + class DagPipelineEntity < Grape::Entity + expose :ordered_stages_with_preloads, as: :stages, using: Ci::DagStageEntity + + private + + def ordered_stages_with_preloads + object.ordered_stages.preload(preloaded_relations) # rubocop: disable CodeReuse/ActiveRecord + end + + def preloaded_relations + [ + :project, + { latest_statuses: :needs } + ] + end + end +end |