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,
|
fields :name, :element, :shortcode, :favorited, :extra,
|
||||||
:full_auto, :clear_time, :auto_guard, :created_at, :updated_at
|
:full_auto, :clear_time, :auto_guard, :created_at, :updated_at
|
||||||
|
|
||||||
|
field :remix do |p|
|
||||||
|
p.is_remix
|
||||||
|
end
|
||||||
|
|
||||||
association :raid,
|
association :raid,
|
||||||
blueprint: RaidBlueprint
|
blueprint: RaidBlueprint
|
||||||
|
|
||||||
|
|
@ -45,6 +49,10 @@ module Api
|
||||||
association :user,
|
association :user,
|
||||||
blueprint: UserBlueprint,
|
blueprint: UserBlueprint,
|
||||||
view: :minimal
|
view: :minimal
|
||||||
|
|
||||||
|
association :remixes,
|
||||||
|
blueprint: PartyBlueprint,
|
||||||
|
view: :minimal
|
||||||
end
|
end
|
||||||
|
|
||||||
view :jobs do
|
view :jobs do
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,14 @@ class Party < ApplicationRecord
|
||||||
user.favorite_parties.include? self
|
user.favorite_parties.include? self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_remix
|
||||||
|
self.source_party != nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def remixes
|
||||||
|
Party.where(source_party_id: self.id)
|
||||||
|
end
|
||||||
|
|
||||||
def blueprint
|
def blueprint
|
||||||
PartyBlueprint
|
PartyBlueprint
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue