Commit b17c8d67 authored by Shinya Maeda's avatar Shinya Maeda

Use PipelineScheduleDetails

parent c91292b6
...@@ -690,10 +690,13 @@ module API ...@@ -690,10 +690,13 @@ 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 expose :created_at, :updated_at
expose :last_pipeline, using: Entities::PipelineBasic, if: { type: :full }
expose :owner, using: Entities::UserBasic expose :owner, using: Entities::UserBasic
end end
class PipelineScheduleDetails < PipelineSchedule
expose :last_pipeline, using: Entities::PipelineBasic
end
class EnvironmentBasic < Grape::Entity class EnvironmentBasic < Grape::Entity
expose :id, :name, :slug, :external_url expose :id, :name, :slug, :external_url
end end
......
...@@ -21,7 +21,7 @@ module API ...@@ -21,7 +21,7 @@ module API
end end
desc 'Get a single pipeline schedule' do desc 'Get a single pipeline schedule' do
success Entities::PipelineSchedule success Entities::PipelineScheduleDetails
end end
params do params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
...@@ -31,11 +31,11 @@ module API ...@@ -31,11 +31,11 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule not_found!('PipelineSchedule') unless pipeline_schedule
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full present pipeline_schedule, with: Entities::PipelineScheduleDetails
end end
desc 'Create a new pipeline schedule' do desc 'Create a new pipeline schedule' do
success Entities::PipelineSchedule success Entities::PipelineScheduleDetails
end end
params do params do
requires :description, type: String, desc: 'The description of pipeline schedule' requires :description, type: String, desc: 'The description of pipeline schedule'
...@@ -52,14 +52,14 @@ module API ...@@ -52,14 +52,14 @@ module API
.execute .execute
if pipeline_schedule.persisted? if pipeline_schedule.persisted?
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full present pipeline_schedule, with: Entities::PipelineScheduleDetails
else else
render_validation_error!(pipeline_schedule) render_validation_error!(pipeline_schedule)
end end
end end
desc 'Edit a pipeline schedule' do desc 'Edit a pipeline schedule' do
success Entities::PipelineSchedule success Entities::PipelineScheduleDetails
end end
params do params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
...@@ -75,14 +75,14 @@ module API ...@@ -75,14 +75,14 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.update(declared_params(include_missing: false)) if pipeline_schedule.update(declared_params(include_missing: false))
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full present pipeline_schedule, with: Entities::PipelineScheduleDetails
else else
render_validation_error!(pipeline_schedule) render_validation_error!(pipeline_schedule)
end end
end end
desc 'Take ownership of a pipeline schedule' do desc 'Take ownership of a pipeline schedule' do
success Entities::PipelineSchedule success Entities::PipelineScheduleDetails
end end
params do params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
...@@ -93,14 +93,14 @@ module API ...@@ -93,14 +93,14 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.own!(current_user) if pipeline_schedule.own!(current_user)
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full present pipeline_schedule, with: Entities::PipelineScheduleDetails
else else
render_validation_error!(pipeline_schedule) render_validation_error!(pipeline_schedule)
end end
end end
desc 'Delete a pipeline schedule' do desc 'Delete a pipeline schedule' do
success Entities::PipelineSchedule success Entities::PipelineScheduleDetails
end end
params do params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id' requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
...@@ -110,7 +110,7 @@ module API ...@@ -110,7 +110,7 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule not_found!('PipelineSchedule') unless pipeline_schedule
present pipeline_schedule.destroy, with: Entities::PipelineSchedule, type: :full present pipeline_schedule.destroy, with: Entities::PipelineScheduleDetails
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment