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