Update Raid blueprint with views
This commit is contained in:
parent
e10571b131
commit
2001bbcb34
2 changed files with 18 additions and 7 deletions
|
|
@ -3,14 +3,21 @@
|
|||
module Api
|
||||
module V1
|
||||
class RaidBlueprint < ApiBlueprint
|
||||
field :name do |raid|
|
||||
{
|
||||
en: raid.name_en,
|
||||
ja: raid.name_jp
|
||||
}
|
||||
view :nested do
|
||||
field :name do |raid|
|
||||
{
|
||||
en: raid.name_en,
|
||||
ja: raid.name_jp
|
||||
}
|
||||
end
|
||||
|
||||
fields :slug, :level, :element
|
||||
end
|
||||
|
||||
fields :slug, :level, :group, :element
|
||||
view :full do
|
||||
include_view :nested
|
||||
association :group, blueprint: RaidGroupBlueprint
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,11 @@ module Api
|
|||
module V1
|
||||
class RaidsController < Api::V1::ApiController
|
||||
def all
|
||||
render json: RaidBlueprint.render(Raid.all)
|
||||
render json: RaidBlueprint.render(Raid.all, view: :full)
|
||||
end
|
||||
|
||||
def groups
|
||||
render json: RaidGroupBlueprint.render(RaidGroup.all)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue