BigW Consortium Gitlab

Commit bfa028e1 by Shinya Maeda

Remove deleted_at from Entity. Use find_by. Remove returns.

parent f6a8894a
......@@ -689,7 +689,7 @@ module API
class PipelineSchedule < Grape::Entity
expose :id
expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active
expose :created_at, :updated_at, :deleted_at
expose :created_at, :updated_at
expose :last_pipeline, using: Entities::PipelineBasic, if: { type: :full }
expose :owner, using: Entities::UserBasic
end
......
......@@ -29,7 +29,7 @@ module API
get ':id/pipeline_schedules/:pipeline_schedule_id' do
authorize! :read_pipeline_schedule, user_project
return not_found!('PipelineSchedule') unless pipeline_schedule
not_found!('PipelineSchedule') unless pipeline_schedule
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
end
......@@ -72,7 +72,7 @@ module API
put ':id/pipeline_schedules/:pipeline_schedule_id' do
authorize! :create_pipeline_schedule, user_project
return not_found!('PipelineSchedule') unless pipeline_schedule
not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.update(declared_params(include_missing: false))
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
......@@ -90,7 +90,7 @@ module API
post ':id/pipeline_schedules/:pipeline_schedule_id/take_ownership' do
authorize! :create_pipeline_schedule, user_project
return not_found!('PipelineSchedule') unless pipeline_schedule
not_found!('PipelineSchedule') unless pipeline_schedule
if pipeline_schedule.own!(current_user)
present pipeline_schedule, with: Entities::PipelineSchedule, type: :full
......@@ -108,7 +108,7 @@ module API
delete ':id/pipeline_schedules/:pipeline_schedule_id' do
authorize! :admin_pipeline_schedule, user_project
return not_found!('PipelineSchedule') unless pipeline_schedule
not_found!('PipelineSchedule') unless pipeline_schedule
present pipeline_schedule.destroy, with: Entities::PipelineSchedule, type: :full
end
......@@ -124,7 +124,7 @@ module API
@pipeline_schedule ||=
user_project.pipeline_schedules
.preload([:owner, :last_pipeline])
.find(params.delete(:pipeline_schedule_id))
.find_by(id: params.delete(:pipeline_schedule_id))
end
end
end
......
......@@ -10,7 +10,6 @@
"active": { "type": "boolean" },
"created_at": { "type": "date" },
"updated_at": { "type": "date" },
"deleted_at": { "type": "date" },
"last_pipeline": {
"type": ["object", "null"],
"properties": {
......@@ -36,7 +35,7 @@
},
"required": [
"id", "description", "ref", "cron", "cron_timezone", "next_run_at",
"active", "created_at", "updated_at", "deleted_at", "owner"
"active", "created_at", "updated_at", "owner"
],
"additionalProperties": false
}
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