From 3b6edfae5d65e07b64726b9e193389629d33da98 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 21 Dec 2022 21:04:42 -0800 Subject: [PATCH] Update WeaponKey output for blueprinter --- app/blueprints/api/v1/weapon_key_blueprint.rb | 8 ++++++++ app/controllers/api/v1/weapon_keys_controller.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/blueprints/api/v1/weapon_key_blueprint.rb b/app/blueprints/api/v1/weapon_key_blueprint.rb index 4a959df..64ed12f 100644 --- a/app/blueprints/api/v1/weapon_key_blueprint.rb +++ b/app/blueprints/api/v1/weapon_key_blueprint.rb @@ -3,6 +3,14 @@ module Api module V1 class WeaponKeyBlueprint < ApiBlueprint + field :name do |key| + { + en: key.name_en, + ja: key.name_jp + } + end + + fields :series, :slot, :group, :order end end end diff --git a/app/controllers/api/v1/weapon_keys_controller.rb b/app/controllers/api/v1/weapon_keys_controller.rb index 8bdcaaa..f9ba041 100644 --- a/app/controllers/api/v1/weapon_keys_controller.rb +++ b/app/controllers/api/v1/weapon_keys_controller.rb @@ -10,7 +10,7 @@ module Api conditions[:group] = request.params['group'] unless request.params['group'].blank? @keys = WeaponKey.where(conditions) - render :all, status: :ok + render json: WeaponKeyBlueprint.render(@keys) end end end