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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
415 B
Ruby
Raw Normal View History

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