fix /jobs/:id/skills to return job's own skills, add emp_skills endpoint

This commit is contained in:
Justin Edmund 2025-12-15 14:30:32 -08:00
parent b458335e31
commit 834192dc11
2 changed files with 13 additions and 0 deletions

View file

@ -7,7 +7,19 @@ module Api
render json: JobSkillBlueprint.render(JobSkill.includes(:job).all)
end
# Returns skills that belong to a specific job
def job
job = Job.find_by(granblue_id: params[:id])
return render_not_found_response('job') unless job
@skills = JobSkill.includes(:job)
.where(job_id: job.id)
.order(:order)
render json: JobSkillBlueprint.render(@skills)
end
# Returns EMP skills from other jobs (for party skill selection)
def emp
@skills = JobSkill.includes(:job)
.where.not(job_id: params[:id])
.where(emp: true)

View file

@ -90,6 +90,7 @@ Rails.application.routes.draw do
get 'jobs/:id', to: 'jobs#show'
put 'jobs/:id', to: 'jobs#update'
get 'jobs/:id/skills', to: 'job_skills#job'
get 'jobs/:id/emp_skills', to: 'job_skills#emp'
get 'jobs/:id/accessories', to: 'job_accessories#job'
get 'characters/:id/related', to: 'characters#related'