2020-05-24 23:13:21 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Ci
|
|
|
|
class DagPipelineEntity < Grape::Entity
|
2020-06-23 00:09:42 +05:30
|
|
|
expose :stages_with_preloads, as: :stages, using: Ci::DagStageEntity
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
private
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
def stages_with_preloads
|
|
|
|
object.stages.preload(preloaded_relations) # rubocop: disable CodeReuse/ActiveRecord
|
2020-05-24 23:13:21 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def preloaded_relations
|
|
|
|
[
|
|
|
|
:project,
|
|
|
|
{ latest_statuses: :needs }
|
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|