Commit bfa028e1 authored by Shinya Maeda's avatar Shinya Maeda

Remove deleted_at from Entity. Use find_by. Remove returns.

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