add recruited_by field to character blueprint
This commit is contained in:
parent
05dd8996a4
commit
cb016580bd
1 changed files with 17 additions and 0 deletions
|
|
@ -63,6 +63,23 @@ module Api
|
|||
kamigame: c.kamigame
|
||||
}
|
||||
end
|
||||
|
||||
# Reverse relationship: which weapon recruits this character
|
||||
field :recruited_by do |c|
|
||||
weapon = Weapon.find_by(recruits: c.granblue_id)
|
||||
next nil unless weapon
|
||||
|
||||
{
|
||||
id: weapon.id,
|
||||
granblue_id: weapon.granblue_id,
|
||||
name: {
|
||||
en: weapon.name_en,
|
||||
ja: weapon.name_jp
|
||||
},
|
||||
promotions: weapon.promotions,
|
||||
promotion_names: weapon.promotion_names
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Separate view for raw data - only used by dedicated endpoint
|
||||
|
|
|
|||
Loading…
Reference in a new issue