2020-05-14 14:08:06 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class DagPipelineEntity < Grape::Entity
|
2020-05-21 02:08:25 -04:00
|
|
|
expose :stages_with_preloads, as: :stages, using: Ci::DagStageEntity
|
2020-05-14 14:08:06 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-05-21 02:08:25 -04:00
|
|
|
def stages_with_preloads
|
|
|
|
object.stages.preload(preloaded_relations) # rubocop: disable CodeReuse/ActiveRecord
|
2020-05-14 14:08:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def preloaded_relations
|
|
|
|
[
|
|
|
|
:project,
|
|
|
|
{ latest_statuses: :needs }
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|