add jobs create endpoint
This commit is contained in:
parent
93220df4cd
commit
1272aba2d1
1 changed files with 13 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ module Api
|
||||||
before_action :set_party, only: %w[update_job update_job_skills destroy_job_skill]
|
before_action :set_party, only: %w[update_job update_job_skills destroy_job_skill]
|
||||||
before_action :authorize_party, only: %w[update_job update_job_skills destroy_job_skill]
|
before_action :authorize_party, only: %w[update_job update_job_skills destroy_job_skill]
|
||||||
before_action :set_job, only: %w[update]
|
before_action :set_job, only: %w[update]
|
||||||
before_action :ensure_editor_role, only: %w[update]
|
before_action :ensure_editor_role, only: %w[create update]
|
||||||
|
|
||||||
def all
|
def all
|
||||||
render json: JobBlueprint.render(Job.all)
|
render json: JobBlueprint.render(Job.all)
|
||||||
|
|
@ -16,6 +16,18 @@ module Api
|
||||||
render json: JobBlueprint.render(Job.find_by(granblue_id: params[:id]))
|
render json: JobBlueprint.render(Job.find_by(granblue_id: params[:id]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# POST /jobs
|
||||||
|
# Creates a new job record
|
||||||
|
def create
|
||||||
|
@job = Job.new(job_update_params)
|
||||||
|
|
||||||
|
if @job.save
|
||||||
|
render json: JobBlueprint.render(@job), status: :created
|
||||||
|
else
|
||||||
|
render_validation_error_response(@job)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# PATCH/PUT /jobs/:id
|
# PATCH/PUT /jobs/:id
|
||||||
# Updates an existing job record
|
# Updates an existing job record
|
||||||
def update
|
def update
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue