Add route to get skills for given job

This commit is contained in:
Justin Edmund 2022-11-27 14:12:52 -08:00
parent b9bea3ecf4
commit 5fe712c31a
3 changed files with 20 additions and 1 deletions

View file

@ -3,4 +3,11 @@ class Api::V1::JobsController < Api::V1::ApiController
@jobs = Job.all()
render :all, status: :ok
end
end
def skills
job = Job.find(params[:id])
@skills = JobSkill.where(job: job).or(JobSkill.where(sub: true))
render :skills, status: :ok
end
end

View file

@ -0,0 +1,11 @@
collection @skills
attributes :id, :job, :slug, :color, :main, :base, :sub, :emp, :order
node :name do |w|
{
:en => w.name_en,
:ja => w.name_jp
}
end

View file

@ -27,6 +27,7 @@ Rails.application.routes.draw do
post 'search/summons', to: 'search#summons'
get 'jobs', to: 'jobs#all'
get 'jobs/:id/skills', to: 'jobs#skills'
get 'raids', to: 'raids#all'
get 'weapon_keys', to: 'weapon_keys#all'