include reroll_slot and grades in artifact responses
This commit is contained in:
parent
58cb970457
commit
8787aa34a3
4 changed files with 17 additions and 5 deletions
|
|
@ -5,7 +5,7 @@ module Api
|
||||||
class CollectionArtifactBlueprint < ApiBlueprint
|
class CollectionArtifactBlueprint < ApiBlueprint
|
||||||
identifier :id
|
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
|
# Proficiency is only present on quirk artifacts
|
||||||
field :proficiency, if: ->(_field, obj, _options) { obj.proficiency.present? }
|
field :proficiency, if: ->(_field, obj, _options) { obj.proficiency.present? }
|
||||||
|
|
@ -27,6 +27,14 @@ module Api
|
||||||
view :full do
|
view :full do
|
||||||
association :artifact, blueprint: ArtifactBlueprint
|
association :artifact, blueprint: ArtifactBlueprint
|
||||||
end
|
end
|
||||||
|
|
||||||
|
view :graded do
|
||||||
|
include_view :full
|
||||||
|
|
||||||
|
field :grade do |obj|
|
||||||
|
ArtifactGrader.new(obj).grade
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
module Api
|
module Api
|
||||||
module V1
|
module V1
|
||||||
class GridArtifactBlueprint < ApiBlueprint
|
class GridArtifactBlueprint < ApiBlueprint
|
||||||
fields :element, :level
|
fields :element, :level, :reroll_slot
|
||||||
|
|
||||||
# Proficiency is only present on quirk artifacts
|
# Proficiency is only present on quirk artifacts
|
||||||
field :proficiency, if: ->(_field, obj, _options) { obj.proficiency.present? }
|
field :proficiency, if: ->(_field, obj, _options) { obj.proficiency.present? }
|
||||||
|
|
@ -22,6 +22,10 @@ module Api
|
||||||
|
|
||||||
view :nested do
|
view :nested do
|
||||||
association :artifact, blueprint: ArtifactBlueprint
|
association :artifact, blueprint: ArtifactBlueprint
|
||||||
|
|
||||||
|
field :grade do |obj|
|
||||||
|
ArtifactGrader.new(obj).grade
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
view :full do
|
view :full do
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ module Api
|
||||||
|
|
||||||
def collection_artifact_params
|
def collection_artifact_params
|
||||||
params.require(:collection_artifact).permit(
|
params.require(:collection_artifact).permit(
|
||||||
:artifact_id, :element, :proficiency, :level, :nickname,
|
:artifact_id, :element, :proficiency, :level, :nickname, :reroll_slot,
|
||||||
skill1: %i[modifier strength level],
|
skill1: %i[modifier strength level],
|
||||||
skill2: %i[modifier strength level],
|
skill2: %i[modifier strength level],
|
||||||
skill3: %i[modifier strength level],
|
skill3: %i[modifier strength level],
|
||||||
|
|
@ -135,7 +135,7 @@ module Api
|
||||||
|
|
||||||
def batch_artifact_params
|
def batch_artifact_params
|
||||||
params.permit(collection_artifacts: [
|
params.permit(collection_artifacts: [
|
||||||
:artifact_id, :element, :proficiency, :level, :nickname,
|
:artifact_id, :element, :proficiency, :level, :nickname, :reroll_slot,
|
||||||
{ skill1: %i[modifier strength level] },
|
{ skill1: %i[modifier strength level] },
|
||||||
{ skill2: %i[modifier strength level] },
|
{ skill2: %i[modifier strength level] },
|
||||||
{ skill3: %i[modifier strength level] },
|
{ skill3: %i[modifier strength level] },
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ module Api
|
||||||
|
|
||||||
def grid_artifact_params
|
def grid_artifact_params
|
||||||
params.require(:grid_artifact).permit(
|
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],
|
skill1: %i[modifier strength level],
|
||||||
skill2: %i[modifier strength level],
|
skill2: %i[modifier strength level],
|
||||||
skill3: %i[modifier strength level],
|
skill3: %i[modifier strength level],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue