Commit b17c8d67 authored by Shinya Maeda's avatar Shinya Maeda

Use PipelineScheduleDetails

parent c91292b6
......@@ -690,10 +690,13 @@ module API
expose :id
expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active
expose :created_at, :updated_at
expose :last_pipeline, using: Entities::PipelineBasic, if: { type: :full }
expose :owner, using: Entities::UserBasic
end
class PipelineScheduleDetails < PipelineSchedule
expose :last_pipeline, using: Entities::PipelineBasic
end
class EnvironmentBasic < Grape::Entity
expose :id, :name, :slug, :external_url
end
......
......@@ -21,7 +21,7 @@ module API
end
desc 'Get a single pipeline schedule' do
success Entities::PipelineSchedule
success Entities::PipelineScheduleDetails
end
params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
......@@ -31,11 +31,11 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
present pipeline_schedule, with: Entities::PipelineScheduleDetails
end
desc 'Create a new pipeline schedule' do
success Entities::PipelineSchedule
success Entities::PipelineScheduleDetails
end
params do
requires :description, type: String, desc: 'The description of pipeline schedule'
......@@ -52,14 +52,14 @@ module API
.execute
if pipeline_schedule.persisted?
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
present pipeline_schedule, with: Entities::PipelineScheduleDetails
else
render_validation_error!(pipeline_schedule)
end
end
desc 'Edit a pipeline schedule' do
success Entities::PipelineSchedule
success Entities::PipelineScheduleDetails
end
params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
......@@ -75,14 +75,14 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.update(declared_params(include_missing: false))
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
present pipeline_schedule, with: Entities::PipelineScheduleDetails
else
render_validation_error!(pipeline_schedule)
end
end
desc 'Take ownership of a pipeline schedule' do
success Entities::PipelineSchedule
success Entities::PipelineScheduleDetails
end
params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
......@@ -93,14 +93,14 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.own!(current_user)
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
present pipeline_schedule, with: Entities::PipelineScheduleDetails
else
render_validation_error!(pipeline_schedule)
end
end
desc 'Delete a pipeline schedule' do
success Entities::PipelineSchedule
success Entities::PipelineScheduleDetails
end
params do
requires :pipeline_schedule_id, type: Integer, desc: 'The pipeline schedule id'
......@@ -110,7 +110,7 @@ module API
not_found!('PipelineSchedule') unless pipeline_schedule
present pipeline_schedule.destroy, with: Entities::PipelineSchedule, type: :full
present pipeline_schedule.destroy, with: Entities::PipelineScheduleDetails
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