include reroll_slot and grades in artifact responses

This commit is contained in:
Justin Edmund 2025-12-03 13:27:35 -08:00
parent 58cb970457
commit 8787aa34a3
4 changed files with 17 additions and 5 deletions

View file

@ -5,7 +5,7 @@ module Api
class CollectionArtifactBlueprint < ApiBlueprint
identifier :id
fields :element, :level, :nickname, :created_at, :updated_at
fields :element, :level, :nickname, :reroll_slot, :created_at, :updated_at
# Proficiency is only present on quirk artifacts
field :proficiency, if: ->(_field, obj, _options) { obj.proficiency.present? }
@ -27,6 +27,14 @@ module Api
view :full do
association :artifact, blueprint: ArtifactBlueprint
end
view :graded do
include_view :full
field :grade do |obj|
ArtifactGrader.new(obj).grade
end
end
end
end
end

View file

@ -3,7 +3,7 @@
module Api
module V1
class GridArtifactBlueprint < ApiBlueprint
fields :element, :level
fields :element, :level, :reroll_slot
# Proficiency is only present on quirk artifacts
field :proficiency, if: ->(_field, obj, _options) { obj.proficiency.present? }
@ -22,6 +22,10 @@ module Api
view :nested do
association :artifact, blueprint: ArtifactBlueprint
field :grade do |obj|
ArtifactGrader.new(obj).grade
end
end
view :full do

View file

@ -125,7 +125,7 @@ module Api
def collection_artifact_params
params.require(:collection_artifact).permit(
:artifact_id, :element, :proficiency, :level, :nickname,
:artifact_id, :element, :proficiency, :level, :nickname, :reroll_slot,
skill1: %i[modifier strength level],
skill2: %i[modifier strength level],
skill3: %i[modifier strength level],
@ -135,7 +135,7 @@ module Api
def batch_artifact_params
params.permit(collection_artifacts: [
:artifact_id, :element, :proficiency, :level, :nickname,
:artifact_id, :element, :proficiency, :level, :nickname, :reroll_slot,
{ skill1: %i[modifier strength level] },
{ skill2: %i[modifier strength level] },
{ skill3: %i[modifier strength level] },

View file

@ -107,7 +107,7 @@ module Api
def grid_artifact_params
params.require(:grid_artifact).permit(
:grid_character_id, :artifact_id, :element, :proficiency, :level,
:grid_character_id, :artifact_id, :element, :proficiency, :level, :reroll_slot,
skill1: %i[modifier strength level],
skill2: %i[modifier strength level],
skill3: %i[modifier strength level],