From 1272aba2d1b5b2175c6da571792994fc8e6b1626 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 4 Jan 2026 02:50:03 -0800 Subject: [PATCH] add jobs create endpoint --- app/controllers/api/v1/jobs_controller.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/jobs_controller.rb b/app/controllers/api/v1/jobs_controller.rb index 0a9d259..62bc962 100644 --- a/app/controllers/api/v1/jobs_controller.rb +++ b/app/controllers/api/v1/jobs_controller.rb @@ -6,7 +6,7 @@ module Api 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 :set_job, only: %w[update] - before_action :ensure_editor_role, only: %w[update] + before_action :ensure_editor_role, only: %w[create update] def all render json: JobBlueprint.render(Job.all) @@ -16,6 +16,18 @@ module Api render json: JobBlueprint.render(Job.find_by(granblue_id: params[:id])) 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 # Updates an existing job record def update