Skip to content
Snippets Groups Projects
Commit 17b9128b authored by Shinya Maeda's avatar Shinya Maeda
Browse files

includes last_pipeline

parent df6040bb
No related branches found
No related tags found
No related merge requests found
Loading
@@ -690,9 +690,7 @@ module API
Loading
@@ -690,9 +690,7 @@ module API
expose :id expose :id
expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active
expose :created_at, :updated_at, :deleted_at expose :created_at, :updated_at, :deleted_at
expose :last_pipeline, using: Entities::Pipeline do |pipeline_schedule| expose :last_pipeline, using: Entities::Pipeline
pipeline_schedule.pipelines&.last
end
expose :owner, using: Entities::UserBasic expose :owner, using: Entities::UserBasic
end end
   
Loading
Loading
Loading
@@ -17,7 +17,7 @@ module API
Loading
@@ -17,7 +17,7 @@ module API
get ':id/pipeline_schedules' do get ':id/pipeline_schedules' do
authorize! :read_pipeline_schedule, user_project authorize! :read_pipeline_schedule, user_project
   
pipeline_schedules = user_project.pipeline_schedules.preload(:pipelines) pipeline_schedules = user_project.pipeline_schedules.includes(last_pipeline: {statuses: :latest})
   
present paginate(pipeline_schedules), with: Entities::PipelineSchedule present paginate(pipeline_schedules), with: Entities::PipelineSchedule
end end
Loading
Loading
Loading
@@ -31,6 +31,9 @@ describe API::PipelineSchedules do
Loading
@@ -31,6 +31,9 @@ describe API::PipelineSchedules do
end.count end.count
   
create_list(:ci_pipeline_schedule, 10, project: project, owner: developer) create_list(:ci_pipeline_schedule, 10, project: project, owner: developer)
.each do |pipeline_schedule|
pipeline_schedule.pipelines << build(:ci_pipeline, project: project)
end
   
expect do expect do
get api("/projects/#{project.id}/pipeline_schedules", developer) get api("/projects/#{project.id}/pipeline_schedules", developer)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment