jobs: rename /delayed_jobs to /jobs.

Rename the /delayed_jobs endpoint to just /jobs since it's no longer
based on DelayedJob.
This commit is contained in:
evazion
2022-01-02 21:19:27 -06:00
parent f7784d2340
commit 21a9bb2c63
9 changed files with 17 additions and 16 deletions

View File

@@ -0,0 +1,34 @@
# frozen_string_literal: true
class JobsController < ApplicationController
respond_to :html, :xml, :json, :js
def index
@jobs = authorize GoodJob::ActiveJobJob.order(created_at: :desc).extending(PaginationExtension).paginate(params[:page], limit: params[:limit]), policy_class: GoodJobPolicy
respond_with(@jobs)
end
def cancel
@job = authorize GoodJob::ActiveJobJob.find(params[:id]), policy_class: GoodJobPolicy
@job.discard_job("Canceled")
respond_with(@job)
end
def retry
@job = authorize GoodJob::ActiveJobJob.find(params[:id]), policy_class: GoodJobPolicy
@job.retry_job
respond_with(@job)
end
def run
@job = authorize GoodJob::ActiveJobJob.find(params[:id]), policy_class: GoodJobPolicy
@job.reschedule_job
respond_with(@job)
end
def destroy
@job = authorize GoodJob::ActiveJobJob.find(params[:id]), policy_class: GoodJobPolicy
@job.destroy
respond_with(@job)
end
end