Add remix state and remixes to output

This commit is contained in:
Justin Edmund 2023-01-27 23:33:28 -08:00
parent 1e0ada0613
commit 986ef2fb56
2 changed files with 17 additions and 1 deletions

View file

@ -36,6 +36,10 @@ module Api
fields :name, :element, :shortcode, :favorited, :extra,
:full_auto, :clear_time, :auto_guard, :created_at, :updated_at
field :remix do |p|
p.is_remix
end
association :raid,
blueprint: RaidBlueprint
@ -45,6 +49,10 @@ module Api
association :user,
blueprint: UserBlueprint,
view: :minimal
association :remixes,
blueprint: PartyBlueprint,
view: :minimal
end
view :jobs do

View file

@ -20,7 +20,7 @@ class Party < ApplicationRecord
foreign_key: 'accessory_id',
class_name: 'JobAccessory',
optional: true
belongs_to :skill0,
foreign_key: 'skill0_id',
class_name: 'JobSkill',
@ -82,6 +82,14 @@ class Party < ApplicationRecord
user.favorite_parties.include? self
end
def is_remix
self.source_party != nil
end
def remixes
Party.where(source_party_id: self.id)
end
def blueprint
PartyBlueprint
end