debian-mirror-gitlab/app/serializers/ci/dag_pipeline_entity.rb

21 lines
439 B
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# 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