Add remix state and remixes to output
This commit is contained in:
parent
1e0ada0613
commit
986ef2fb56
2 changed files with 17 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue