diff --git a/app/blueprints/api/v1/grid_summon_blueprint.rb b/app/blueprints/api/v1/grid_summon_blueprint.rb index 1a27594..116b7ab 100644 --- a/app/blueprints/api/v1/grid_summon_blueprint.rb +++ b/app/blueprints/api/v1/grid_summon_blueprint.rb @@ -5,11 +5,11 @@ module Api class GridSummonBlueprint < ApiBlueprint view :uncap do association :party, blueprint: PartyBlueprint, view: :minimal - fields :position, :uncap_level + fields :position, :uncap_level, :transcendence_step end view :nested do - fields :main, :friend, :position, :uncap_level + fields :main, :friend, :position, :uncap_level, :transcendence_step association :summon, name: :object, blueprint: SummonBlueprint end diff --git a/app/controllers/api/v1/grid_characters_controller.rb b/app/controllers/api/v1/grid_characters_controller.rb index 74f521e..376cc46 100644 --- a/app/controllers/api/v1/grid_characters_controller.rb +++ b/app/controllers/api/v1/grid_characters_controller.rb @@ -47,13 +47,9 @@ module Api @character.attributes = character_params.merge(mastery) - if @character.save - ap 'Saved character' - return render json: GridCharacterBlueprint.render(@character, view: :full) if @character.save - else - ap 'Could not save' - render_validation_error_response(@character) - end + return render json: GridCharacterBlueprint.render(@character, view: :full) if @character.save + + render_validation_error_response(@character) end def resolve @@ -89,6 +85,7 @@ module Api render_unauthorized_response if current_user && (character.party.user != current_user) character.uncap_level = character_params[:uncap_level] + character.transcendence_step = character_params[:transcendence_step] return unless character.save! render json: GridCharacterBlueprint.render(character, view: :nested, root: :grid_character) diff --git a/app/controllers/api/v1/grid_summons_controller.rb b/app/controllers/api/v1/grid_summons_controller.rb index 2a40033..788f3d5 100644 --- a/app/controllers/api/v1/grid_summons_controller.rb +++ b/app/controllers/api/v1/grid_summons_controller.rb @@ -3,7 +3,7 @@ module Api module V1 class GridSummonsController < Api::V1::ApiController - before_action :set, only: %w[destroy] + before_action :set, only: %w[update destroy] attr_reader :party, :incoming_summon @@ -24,6 +24,14 @@ module Api end end + def update + @summon.attributes = summon_params + + return render json: GridSummonBlueprint.render(@summon, view: :nested, root: :grid_summon) if @summon.save + + render_validation_error_response(@character) + end + def save_summon(summon) if (grid_summon = GridSummon.where( party_id: party.id, @@ -57,6 +65,8 @@ module Api render_unauthorized_response if current_user && (summon.party.user != current_user) summon.uncap_level = summon_params[:uncap_level] + summon.transcendence_step = 0 + return unless summon.save! render json: GridSummonBlueprint.render(summon, view: :nested, root: :grid_summon) @@ -91,7 +101,8 @@ module Api # Specify whitelisted properties that can be modified. def summon_params - params.require(:summon).permit(:id, :party_id, :summon_id, :position, :main, :friend, :uncap_level) + params.require(:summon).permit(:id, :party_id, :summon_id, :position, :main, :friend, :uncap_level, + :transcendence_step) end end end diff --git a/config/routes.rb b/config/routes.rb index 3b54234..788351a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ Rails.application.routes.draw do resources :users, only: %i[create update show] resources :grid_weapons, only: %i[update destroy] resources :grid_characters, only: %i[update destroy] - resources :grid_summons, only: %i[destroy] + resources :grid_summons, only: %i[update destroy] resources :favorites, only: [:create] get 'users/info/:id', to: 'users#info' diff --git a/lib/tasks/export_summon.rake b/lib/tasks/export_summon.rake index 5942ab1..7c81afd 100644 --- a/lib/tasks/export_summon.rake +++ b/lib/tasks/export_summon.rake @@ -36,6 +36,11 @@ namespace :granblue do f.write("#{build_summon_url("#{s.granblue_id}_02", size)} \n") end + + if s.xlb + f.write("#{build_summon_url("#{s.granblue_id}_03", + size)} \n") + end end end