add related characters endpoint

This commit is contained in:
Justin Edmund 2025-11-30 20:16:46 -08:00
parent be5be0c3fe
commit af202716a2
2 changed files with 10 additions and 0 deletions

View file

@ -11,6 +11,14 @@ module Api
render json: CharacterBlueprint.render(@character, view: :full)
end
def related
return render json: [] unless @character.character_id
related = Character.where(character_id: @character.character_id)
.where.not(id: @character.id)
render json: CharacterBlueprint.render(related)
end
private
def set

View file

@ -54,6 +54,8 @@ Rails.application.routes.draw do
get 'jobs/:id/skills', to: 'job_skills#job'
get 'jobs/:id/accessories', to: 'job_accessories#job'
get 'characters/:id/related', to: 'characters#related'
get 'guidebooks', to: 'guidebooks#all'
get 'raids', to: 'raids#all'