June 2023 Update (#102)
* Implements advanced filters (#90) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix a bug where unauthenticated users couldn't view profiles (#92) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix being unable to see profiles when unauth * Add tables used for Siero's revival (#94) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Deploy unauthenticated profile fix (#93) * Implements advanced filters (#90) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix a bug where unauthenticated users couldn't view profiles (#92) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix being unable to see profiles when unauth * Add guidebooks migration * Implement business logic for reading Guidebooks * Change to individual guidebook columns * Properly output guidebook description * Move to 1-index guidebooks * Update party-related files for 1-index guidebooks * Add tables for Siero * Update download and export scripts * Support for Siero, raids rework and edit party rework (#96) * Add guidebooks migration * Implement business logic for reading Guidebooks * Change to individual guidebook columns * Properly output guidebook description * Move to 1-index guidebooks * Update party-related files for 1-index guidebooks * Add tables for Siero * Add raid groups table * Update raid model To belong to the RaidGroup class * Update job class To have many job skills * Add endpoint for raid groups * Update Raid blueprint with views * Added down for creating table * Add guidebooks flag and auto summon flag * Guidebooks → RaidGroup * Auto summon → Party * Add views to Raid blueprint * Add views and guidebook flag to RaidGroup blueprint * Add auto summon and Raid view to Party blueprint * Add quick summons (#97) * Adds quick summon migration * Add route to update quick summon * Add logic to update quick summon * Remove ap call * Add logic to updating summon uncap You couldn't actually update summon transcendence on staging, maybe due to a bug? Now you can. And it won't let you update outside of the bounds of what is defined on the canonical object. * Fix summon logic Updated logic for updating summon uncap and transcendence levels and quick summon status. * Fix searching in Japanese (#99) This was broken because we were using the browser-provided locale as a prefix to our method, but that is 'ja' and our methods were prefixed with 'jp'. * Fix display of base skills (#100) Base skills were not displaying due to a missing case in our search code. This is now fixed. * Update awakenings (#101) * Deploy unauthenticated profile fix (#93) * Implements advanced filters (#90) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix a bug where unauthenticated users couldn't view profiles (#92) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix being unable to see profiles when unauth * Add tables used for Siero's revival (#94) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Deploy unauthenticated profile fix (#93) * Implements advanced filters (#90) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix a bug where unauthenticated users couldn't view profiles (#92) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix being unable to see profiles when unauth * Add guidebooks migration * Implement business logic for reading Guidebooks * Change to individual guidebook columns * Properly output guidebook description * Move to 1-index guidebooks * Update party-related files for 1-index guidebooks * Add tables for Siero * Adds guidebooks and gacha tables (#95) * Implements advanced filters (#90) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix a bug where unauthenticated users couldn't view profiles (#92) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix being unable to see profiles when unauth * Add tables used for Siero's revival (#94) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Deploy unauthenticated profile fix (#93) * Implements advanced filters (#90) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix a bug where unauthenticated users couldn't view profiles (#92) * Implements advanced filters (#90) (#91) * Add advanced filters Adds new filters to search: * Full auto * Charge attack * Auto guard * Number of weapons (user-selectable now) * Number of summons * Number of characters * Maximum number of turns * Maximum number of buttons * Maximum clear time * User quality (No anonymous users) * Name quality (No untitled teams) * Remixes (Only show original teams) * Update advanced filter params * Add default to party counter cache * Fix being unable to see profiles when unauth * Add guidebooks migration * Implement business logic for reading Guidebooks * Change to individual guidebook columns * Properly output guidebook description * Move to 1-index guidebooks * Update party-related files for 1-index guidebooks * Add tables for Siero * Update download and export scripts * Support for Siero, raids rework and edit party rework (#96) * Add guidebooks migration * Implement business logic for reading Guidebooks * Change to individual guidebook columns * Properly output guidebook description * Move to 1-index guidebooks * Update party-related files for 1-index guidebooks * Add tables for Siero * Add raid groups table * Update raid model To belong to the RaidGroup class * Update job class To have many job skills * Add endpoint for raid groups * Update Raid blueprint with views * Added down for creating table * Add guidebooks flag and auto summon flag * Guidebooks → RaidGroup * Auto summon → Party * Add views to Raid blueprint * Add views and guidebook flag to RaidGroup blueprint * Add auto summon and Raid view to Party blueprint * Remove ap call * Add quick summons (#97) * Adds quick summon migration * Add route to update quick summon * Add logic to update quick summon * Add logic to updating summon uncap You couldn't actually update summon transcendence on staging, maybe due to a bug? Now you can. And it won't let you update outside of the bounds of what is defined on the canonical object. * Fix summon logic Updated logic for updating summon uncap and transcendence levels and quick summon status. * Fix searching in Japanese (#99) This was broken because we were using the browser-provided locale as a prefix to our method, but that is 'ja' and our methods were prefixed with 'jp'. * Fix display of base skills (#100) Base skills were not displaying due to a missing case in our search code. This is now fixed. * Squash migrations into one file * Add migrations This adds migrations and data migrations for the awakening update. * A new `Awakenings` table now exists that stores all possible awakenings, with a column for object type. * GridCharacter and GridWeapon now have `awakening_id` and `awakening_level` fields. Their `awakening` and `awakening_type` fields were removed. * Weapons have a mapping table, `WeaponAwakenings`, as not all weapons can be awakened. * Data migrations are included to migrate existing user data. They should be run automatically when the migration is run with `rails db:migrate:with_data` * Add and update models This updates models for the awakening update. * Awakening and WeaponAwakening models were added * Weapon, GridWeapon and GridCharacter models get relationships to the new models defined * GridCharacter had a validation on `awakening_level` that needed to be fixed * Update controllers This updates the GridCharacters and GridWeapons controllers to accept the new fields `awakening_id` and `awakening_level` from clients * Update blueprints This updates the blueprints to match the new schema. The new AwakeningBlueprint was accidentally added already, oops. * Remove re-added migrations * Implement removing job skills (#103) This lets users remove job skills, for if they accidentally set them. * Fix migration
This commit is contained in:
parent
af8b1aa9c1
commit
7faa4883f0
179 changed files with 880 additions and 1189 deletions
6
Gemfile
6
Gemfile
|
|
@ -66,12 +66,16 @@ end
|
|||
|
||||
group :development do
|
||||
gem 'listen'
|
||||
gem 'rubocop'
|
||||
gem 'solargraph'
|
||||
gem 'spring'
|
||||
gem 'spring-commands-rspec'
|
||||
end
|
||||
|
||||
group :tools do
|
||||
gem 'squasher', '>= 0.6.0'
|
||||
gem 'rubocop'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'api_matchers'
|
||||
gem 'byebug'
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ GEM
|
|||
actionpack (>= 5.2)
|
||||
activesupport (>= 5.2)
|
||||
sprockets (>= 3.0.0)
|
||||
squasher (0.7.2)
|
||||
stringio (3.0.4)
|
||||
thor (1.2.1)
|
||||
tilt (2.0.11)
|
||||
|
|
@ -349,6 +350,7 @@ DEPENDENCIES
|
|||
spring
|
||||
spring-commands-rspec
|
||||
sprockets-rails
|
||||
squasher (>= 0.6.0)
|
||||
will_paginate (~> 3.3)
|
||||
|
||||
RUBY VERSION
|
||||
|
|
|
|||
16
app/blueprints/api/v1/awakening_blueprint.rb
Normal file
16
app/blueprints/api/v1/awakening_blueprint.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Api
|
||||
module V1
|
||||
class AwakeningBlueprint < ApiBlueprint
|
||||
field :name do |w|
|
||||
{
|
||||
en: w.name_en,
|
||||
ja: w.name_jp
|
||||
}
|
||||
end
|
||||
|
||||
fields :slug, :object_type, :order
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -63,6 +63,12 @@ module Api
|
|||
ougi_ratio_flb: w.ougi_ratio_flb
|
||||
}
|
||||
end
|
||||
|
||||
field :awakenings do
|
||||
Awakening.where(object_type: 'Character').map do |a|
|
||||
AwakeningBlueprint.render_as_hash(a)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,7 +18,10 @@ module Api
|
|||
end
|
||||
|
||||
field :awakening do |c|
|
||||
c.awakening
|
||||
{
|
||||
type: AwakeningBlueprint.render_as_hash(c.awakening),
|
||||
level: c.awakening_level
|
||||
}
|
||||
end
|
||||
|
||||
field :over_mastery, if: lambda { |_fn, obj, _opt|
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Api
|
|||
end
|
||||
|
||||
view :nested do
|
||||
fields :main, :friend, :position, :uncap_level, :transcendence_step
|
||||
fields :main, :friend, :position, :quick_summon, :uncap_level, :transcendence_step
|
||||
association :summon, name: :object, blueprint: SummonBlueprint
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ module Api
|
|||
end
|
||||
end
|
||||
|
||||
field :awakening, if: ->(_field_name, w, _options) { w.weapon.awakening } do |w|
|
||||
field :awakening, if: ->(_field_name, w, _options) { w.awakening_id } do |w|
|
||||
{
|
||||
type: w.awakening_type,
|
||||
type: AwakeningBlueprint.render_as_hash(w.awakening),
|
||||
level: w.awakening_level
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ module Api
|
|||
|
||||
view :minimal do
|
||||
fields :name, :element, :shortcode, :favorited, :extra,
|
||||
:full_auto, :clear_time, :auto_guard, :created_at, :updated_at
|
||||
:full_auto, :clear_time, :auto_guard, :auto_summon,
|
||||
:created_at, :updated_at
|
||||
|
||||
field :remix do |p|
|
||||
p.is_remix
|
||||
|
|
@ -49,7 +50,8 @@ module Api
|
|||
end
|
||||
|
||||
association :raid,
|
||||
blueprint: RaidBlueprint
|
||||
blueprint: RaidBlueprint,
|
||||
view: :full
|
||||
|
||||
association :job,
|
||||
blueprint: JobBlueprint
|
||||
|
|
|
|||
|
|
@ -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, view: :flat
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
23
app/blueprints/api/v1/raid_group_blueprint.rb
Normal file
23
app/blueprints/api/v1/raid_group_blueprint.rb
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Api
|
||||
module V1
|
||||
class RaidGroupBlueprint < ApiBlueprint
|
||||
view :flat do
|
||||
field :name do |group|
|
||||
{
|
||||
en: group.name_en,
|
||||
ja: group.name_jp
|
||||
}
|
||||
end
|
||||
|
||||
fields :difficulty, :order, :section, :extra, :guidebooks, :hl
|
||||
end
|
||||
|
||||
view :full do
|
||||
include_view :flat
|
||||
association :raids, blueprint: RaidBlueprint, view: :full
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -11,8 +11,8 @@ module Api
|
|||
end
|
||||
|
||||
fields :granblue_id, :element, :proficiency,
|
||||
:max_level, :max_skill_level, :limit, :rarity,
|
||||
:series, :ax, :ax_type, :awakening
|
||||
:max_level, :max_skill_level, :max_awakening_level, :limit, :rarity,
|
||||
:series, :ax, :ax_type
|
||||
|
||||
field :uncap do |w|
|
||||
{
|
||||
|
|
@ -38,6 +38,12 @@ module Api
|
|||
max_atk_ulb: w.max_atk_ulb
|
||||
}
|
||||
end
|
||||
|
||||
field :awakenings, if: ->(_field_name, w, _options) { w.awakenings } do |w|
|
||||
w.awakenings.map do |a|
|
||||
AwakeningBlueprint.render_as_hash(a)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -147,9 +147,10 @@ module Api
|
|||
def character_params
|
||||
params.require(:character).permit(:id, :party_id, :character_id, :position,
|
||||
:uncap_level, :transcendence_step, :perpetuity,
|
||||
:awakening_id, :awakening_level,
|
||||
ring1: %i[modifier strength], ring2: %i[modifier strength],
|
||||
ring3: %i[modifier strength], ring4: %i[modifier strength],
|
||||
earring: %i[modifier strength], awakening: %i[type level])
|
||||
earring: %i[modifier strength])
|
||||
end
|
||||
|
||||
def resolve_params
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ module Api
|
|||
module V1
|
||||
class GridSummonsController < Api::V1::ApiController
|
||||
attr_reader :party, :incoming_summon
|
||||
|
||||
before_action :set, only: %w[update destroy]
|
||||
|
||||
before_action :set, only: %w[update update_uncap_level update_quick_summon destroy]
|
||||
before_action :find_party, only: :create
|
||||
before_action :find_incoming_summon, only: :create
|
||||
before_action :authorize, only: %i[create update destroy]
|
||||
before_action :authorize, only: %i[create update update_uncap_level update_quick_summon destroy]
|
||||
|
||||
def create
|
||||
# Create the GridSummon with the desired parameters
|
||||
|
|
@ -30,6 +30,59 @@ module Api
|
|||
render_validation_error_response(@character)
|
||||
end
|
||||
|
||||
def update_uncap_level
|
||||
summon = @summon.summon
|
||||
max_uncap_level = if summon.flb && !summon.ulb
|
||||
4
|
||||
elsif summon.ulb
|
||||
5
|
||||
else
|
||||
3
|
||||
end
|
||||
|
||||
greater_than_max_uncap = summon_params[:uncap_level].to_i > max_uncap_level
|
||||
can_be_transcended = summon.xlb && summon_params[:transcendence_step] && summon_params[:transcendence_step]&.to_i.positive?
|
||||
|
||||
uncap_level = if greater_than_max_uncap || can_be_transcended
|
||||
max_uncap_level
|
||||
else
|
||||
summon_params[:uncap_level]
|
||||
end
|
||||
|
||||
transcendence_step = if summon.xlb && summon_params[:transcendence_step]
|
||||
summon_params[:transcendence_step]
|
||||
else
|
||||
0
|
||||
end
|
||||
|
||||
@summon.update!(
|
||||
uncap_level: uncap_level,
|
||||
transcendence_step: transcendence_step
|
||||
)
|
||||
|
||||
return unless @summon.persisted?
|
||||
|
||||
render json: GridSummonBlueprint.render(@summon, view: :nested, root: :grid_summon)
|
||||
end
|
||||
|
||||
def update_quick_summon
|
||||
return if [4, 5, 6].include?(@summon.position)
|
||||
|
||||
quick_summons = @summon.party.summons.select(&:quick_summon)
|
||||
|
||||
quick_summons.each do |summon|
|
||||
summon.update!(quick_summon: false)
|
||||
end
|
||||
|
||||
@summon.update!(quick_summon: summon_params[:quick_summon])
|
||||
return unless @summon.persisted?
|
||||
|
||||
quick_summons -= [@summon]
|
||||
summons = [@summon] + quick_summons
|
||||
|
||||
render json: GridSummonBlueprint.render(summons, view: :nested, root: :summons)
|
||||
end
|
||||
|
||||
def save_summon(summon)
|
||||
if (grid_summon = GridSummon.where(
|
||||
party_id: party.id,
|
||||
|
|
@ -46,7 +99,6 @@ module Api
|
|||
|
||||
def handle_conflict(summon)
|
||||
conflict_summon = summon.conflicts(party)
|
||||
ap conflict_summon
|
||||
return unless conflict_summon.summon.id == incoming_summon.id
|
||||
|
||||
old_position = conflict_summon.position
|
||||
|
|
@ -58,19 +110,6 @@ module Api
|
|||
render json: output
|
||||
end
|
||||
|
||||
def update_uncap_level
|
||||
summon = GridSummon.find(summon_params[:id])
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
def destroy
|
||||
render_unauthorized_response if @summon.party.user != current_user
|
||||
return render json: GridSummonBlueprint.render(@summon, view: :destroyed) if @summon.destroy
|
||||
|
|
@ -103,13 +142,14 @@ module Api
|
|||
end
|
||||
|
||||
def set
|
||||
@summon = GridSummon.where('id = ?', params[:id]).first
|
||||
id = summon_params[:id] ? summon_params[:id] : params[:id]
|
||||
@summon = GridSummon.where('id = ?', id).first
|
||||
end
|
||||
|
||||
# Specify whitelisted properties that can be modified.
|
||||
def summon_params
|
||||
params.require(:summon).permit(:id, :party_id, :summon_id, :position, :main, :friend, :uncap_level,
|
||||
:transcendence_step)
|
||||
params.require(:summon).permit(:id, :party_id, :summon_id, :position, :main, :friend,
|
||||
:quick_summon, :uncap_level, :transcendence_step)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ module Api
|
|||
:position, :mainhand, :uncap_level, :element,
|
||||
:weapon_key1_id, :weapon_key2_id, :weapon_key3_id,
|
||||
:ax_modifier1, :ax_modifier2, :ax_strength1, :ax_strength2,
|
||||
:awakening_type, :awakening_level
|
||||
:awakening_id, :awakening_level
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
module Api
|
||||
module V1
|
||||
class JobsController < Api::V1::ApiController
|
||||
before_action :set, only: %w[update_job update_job_skills]
|
||||
before_action :authorize, only: %w[update_job update_job_skills]
|
||||
before_action :set, only: %w[update_job update_job_skills destroy_job_skill]
|
||||
before_action :authorize, only: %w[update_job update_job_skills destroy_job_skill]
|
||||
|
||||
def all
|
||||
render json: JobBlueprint.render(Job.all)
|
||||
|
|
@ -80,6 +80,12 @@ module Api
|
|||
render json: PartyBlueprint.render(@party, view: :jobs) if @party.save!
|
||||
end
|
||||
|
||||
def destroy_job_skill
|
||||
position = job_params[:skill_position].to_i
|
||||
@party["skill#{position}_id"] = nil
|
||||
render json: PartyBlueprint.render(@party, view: :jobs) if @party.save
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def merge_skills_with_existing_skills(
|
||||
|
|
@ -180,7 +186,8 @@ module Api
|
|||
:skill0_id,
|
||||
:skill1_id,
|
||||
:skill2_id,
|
||||
:skill3_id
|
||||
:skill3_id,
|
||||
:skill_position
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ module Api
|
|||
# TODO: Validate accessory with job
|
||||
|
||||
return render json: PartyBlueprint.render(@party, view: :full, root: :party) if @party.save
|
||||
|
||||
|
||||
render_validation_error_response(@party)
|
||||
end
|
||||
|
||||
|
|
@ -259,6 +259,7 @@ module Api
|
|||
:skill3_id,
|
||||
:full_auto,
|
||||
:auto_guard,
|
||||
:auto_summon,
|
||||
:charge_attack,
|
||||
:clear_time,
|
||||
:button_count,
|
||||
|
|
|
|||
|
|
@ -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, view: :full)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -158,6 +158,13 @@ module Api
|
|||
.where(job: { base_job: job.base_job.id }, emp: true)
|
||||
.where.not(job: job.id)
|
||||
)
|
||||
.or(
|
||||
JobSkill.joins(:job)
|
||||
.method("#{locale}_search").call(search_params[:query])
|
||||
.where(conditions)
|
||||
.where(job: { base_job: job.base_job.id }, base: true)
|
||||
.where.not(job: job.id)
|
||||
)
|
||||
else
|
||||
JobSkill.all
|
||||
.joins(:job)
|
||||
|
|
|
|||
15
app/models/awakening.rb
Normal file
15
app/models/awakening.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Awakening < ApplicationRecord
|
||||
def weapon_awakenings
|
||||
WeaponAwakening.where(awakening_id: id)
|
||||
end
|
||||
|
||||
def weapons
|
||||
weapon_awakenings.map(&:weapon)
|
||||
end
|
||||
|
||||
def awakening
|
||||
AwakeningBlueprint
|
||||
end
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@ class Character < ApplicationRecord
|
|||
}
|
||||
}
|
||||
|
||||
pg_search_scope :jp_search,
|
||||
pg_search_scope :ja_search,
|
||||
against: :name_jp,
|
||||
using: {
|
||||
tsearch: {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class GridCharacter < ApplicationRecord
|
||||
belongs_to :awakening, optional: true
|
||||
belongs_to :party,
|
||||
counter_cache: :characters_count,
|
||||
inverse_of: :characters
|
||||
validates_presence_of :party
|
||||
|
||||
validate :awakening_level, on: :update
|
||||
validate :validate_awakening_level, on: :update
|
||||
validate :transcendence, on: :update
|
||||
validate :validate_over_mastery_values, on: :update
|
||||
validate :validate_aetherial_mastery_value, on: :update
|
||||
|
|
@ -22,11 +23,9 @@ class GridCharacter < ApplicationRecord
|
|||
set perpetuity: false
|
||||
end
|
||||
|
||||
def awakening_level
|
||||
return if awakening.nil?
|
||||
|
||||
errors.add(:awakening, 'awakening level too low') if awakening['level'] < 1
|
||||
errors.add(:awakening, 'awakening level too high') if awakening['level'] > 9
|
||||
def validate_awakening_level
|
||||
errors.add(:awakening, 'awakening level too low') if awakening_level < 1
|
||||
errors.add(:awakening, 'awakening level too high') if awakening_level > 9
|
||||
end
|
||||
|
||||
def transcendence
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ class GridWeapon < ApplicationRecord
|
|||
belongs_to :weapon_key2, class_name: 'WeaponKey', foreign_key: :weapon_key2_id, optional: true
|
||||
belongs_to :weapon_key3, class_name: 'WeaponKey', foreign_key: :weapon_key3_id, optional: true
|
||||
|
||||
belongs_to :awakening, optional: true
|
||||
|
||||
validate :compatible_with_position, on: :create
|
||||
validate :no_conflicts, on: :create
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Guidebook < ApplicationRecord
|
|||
}
|
||||
}
|
||||
|
||||
pg_search_scope :jp_search,
|
||||
pg_search_scope :ja_search,
|
||||
against: :name_jp,
|
||||
using: {
|
||||
tsearch: {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
class Job < ApplicationRecord
|
||||
belongs_to :party
|
||||
has_many :skills, class_name: 'JobSkill'
|
||||
|
||||
belongs_to :base_job,
|
||||
foreign_key: 'base_job_id',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class JobSkill < ApplicationRecord
|
|||
}
|
||||
}
|
||||
|
||||
pg_search_scope :jp_search,
|
||||
pg_search_scope :ja_search,
|
||||
against: :name_jp,
|
||||
using: {
|
||||
tsearch: {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Raid < ApplicationRecord
|
||||
belongs_to :group, class_name: 'RaidGroup', foreign_key: :group_id
|
||||
|
||||
def blueprint
|
||||
RaidBlueprint
|
||||
end
|
||||
|
|
|
|||
9
app/models/raid_group.rb
Normal file
9
app/models/raid_group.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class RaidGroup < ApplicationRecord
|
||||
has_many :raids, class_name: 'Raid', foreign_key: :group_id
|
||||
|
||||
def blueprint
|
||||
RaidGroupBlueprint
|
||||
end
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@ class Summon < ApplicationRecord
|
|||
}
|
||||
}
|
||||
|
||||
pg_search_scope :jp_search,
|
||||
pg_search_scope :ja_search,
|
||||
against: :name_jp,
|
||||
using: {
|
||||
tsearch: {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class Weapon < ApplicationRecord
|
|||
}
|
||||
}
|
||||
|
||||
pg_search_scope :jp_search,
|
||||
pg_search_scope :ja_search,
|
||||
against: :name_jp,
|
||||
using: {
|
||||
tsearch: {
|
||||
|
|
@ -20,6 +20,9 @@ class Weapon < ApplicationRecord
|
|||
}
|
||||
}
|
||||
|
||||
has_many :weapon_awakenings
|
||||
has_many :awakenings, through: :weapon_awakenings
|
||||
|
||||
def blueprint
|
||||
WeaponBlueprint
|
||||
end
|
||||
|
|
|
|||
14
app/models/weapon_awakening.rb
Normal file
14
app/models/weapon_awakening.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class WeaponAwakening < ApplicationRecord
|
||||
belongs_to :weapon
|
||||
belongs_to :awakening
|
||||
|
||||
def weapon
|
||||
Weapon.find(weapon_id)
|
||||
end
|
||||
|
||||
def awakening
|
||||
Awakening.find(awakening_id)
|
||||
end
|
||||
end
|
||||
27
bin/squasher
Executable file
27
bin/squasher
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# This file was generated by Bundler.
|
||||
#
|
||||
# The application 'squasher' is installed as part of a gem, and
|
||||
# this file is here to facilitate running it.
|
||||
#
|
||||
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
bundle_binstub = File.expand_path("bundle", __dir__)
|
||||
|
||||
if File.file?(bundle_binstub)
|
||||
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||
load(bundle_binstub)
|
||||
else
|
||||
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||
end
|
||||
end
|
||||
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
load Gem.bin_path("squasher", "squasher")
|
||||
|
|
@ -26,6 +26,7 @@ Rails.application.routes.draw do
|
|||
|
||||
put 'parties/:id/jobs', to: 'jobs#update_job'
|
||||
put 'parties/:id/job_skills', to: 'jobs#update_job_skills'
|
||||
delete 'parties/:id/job_skills', to: 'jobs#destroy_job_skill'
|
||||
|
||||
post 'check/email', to: 'users#check_email'
|
||||
post 'check/username', to: 'users#check_username'
|
||||
|
|
@ -45,6 +46,7 @@ Rails.application.routes.draw do
|
|||
get 'guidebooks', to: 'guidebooks#all'
|
||||
|
||||
get 'raids', to: 'raids#all'
|
||||
get 'raids/groups', to: 'raids#groups'
|
||||
get 'weapon_keys', to: 'weapon_keys#all'
|
||||
|
||||
post 'characters', to: 'grid_characters#create'
|
||||
|
|
@ -59,6 +61,7 @@ Rails.application.routes.draw do
|
|||
|
||||
post 'summons', to: 'grid_summons#create'
|
||||
post 'summons/update_uncap', to: 'grid_summons#update_uncap_level'
|
||||
post 'summons/update_quick_summon', to: 'grid_summons#update_quick_summon'
|
||||
delete 'summons', to: 'grid_summons#destroy'
|
||||
|
||||
delete 'favorites', to: 'favorites#destroy'
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MigrateAxTypeToAx < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
Weapon.all.each do |weapon|
|
||||
if weapon.ax_type > 0
|
||||
weapon.ax = true
|
||||
elsif weapon.ax_type == 0
|
||||
weapon.ax = false
|
||||
weapon.ax_type = nil
|
||||
end
|
||||
|
||||
weapon.save
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SetFlbToFalseOnSummons < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
Summon.all.each do |summon|
|
||||
if summon.flb.nil?
|
||||
summon.flb = false
|
||||
summon.save
|
||||
end
|
||||
|
||||
if summon.ulb.nil?
|
||||
summon.ulb = false
|
||||
summon.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MigrateAwakeningTypeToNewAwakeningType < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
GridWeapon.all.each do |weapon|
|
||||
if weapon.awakening_type&.positive? && weapon.awakening_type <= 3
|
||||
slug = if weapon.awakening_type == 1
|
||||
'weapon-atk'
|
||||
elsif weapon.awakening_type == 2
|
||||
'weapon-def'
|
||||
elsif weapon.awakening_type == 3
|
||||
'weapon-special'
|
||||
end
|
||||
|
||||
ap "#{weapon.weapon.name_en}: #{slug}"
|
||||
|
||||
new_awakening = Awakening.find_by(slug: slug)
|
||||
weapon.awakening_id = new_awakening.id
|
||||
ap weapon.awakening_id
|
||||
weapon.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MigrateCharacterAwakeningTypeToNewAwakeningType < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
GridCharacter.all.each do |character|
|
||||
slug = if character.awakening['type'] == 0
|
||||
'character-balanced'
|
||||
elsif character.awakening['type'] == 1
|
||||
'character-atk'
|
||||
elsif character.awakening['type'] == 2
|
||||
'character-def'
|
||||
elsif character.awakening['type'] == 3
|
||||
'character-multi'
|
||||
else
|
||||
'character-balanced'
|
||||
end
|
||||
|
||||
new_awakening = Awakening.find_by(slug: slug)
|
||||
|
||||
character.awakening_id = new_awakening.id
|
||||
character.awakening_level = character.awakening['level']
|
||||
|
||||
character.save!(validate: false)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +1 @@
|
|||
DataMigrate::Data.define(version: 20230102235227)
|
||||
DataMigrate::Data.define(version: 20230619043726)
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
class EnablePgcryptoExtension < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
enable_extension 'pgcrypto'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
class CreateUsers < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :users, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :email, :unique => true
|
||||
t.string :password_digest
|
||||
t.string :username, :unique => true
|
||||
t.integer :granblue_id, :unique => true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
class CreateWeapons < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :weapons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :name_en
|
||||
t.string :name_jp
|
||||
t.string :granblue_id
|
||||
|
||||
t.integer :rarity
|
||||
t.integer :element
|
||||
t.integer :proficiency
|
||||
t.string :series
|
||||
|
||||
t.boolean :flb
|
||||
t.boolean :ulb
|
||||
|
||||
t.integer :max_level
|
||||
t.integer :max_skill_level
|
||||
t.integer :min_hp
|
||||
t.integer :max_hp
|
||||
t.integer :max_hp_flb
|
||||
t.integer :max_hp_ulb
|
||||
t.integer :min_atk
|
||||
t.integer :max_atk
|
||||
t.integer :max_atk_flb
|
||||
t.integer :max_atk_ulb
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
class CreateParties < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :parties, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.references :user, type: :uuid
|
||||
|
||||
t.string :shortcode
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
class CreateGridWeapons < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :grid_weapons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.references :party, type: :uuid
|
||||
t.references :weapon, type: :uuid
|
||||
|
||||
t.references :weapon_key1, class_name: 'WeaponKey', type: :uuid
|
||||
t.references :weapon_key2, class_name: 'WeaponKey', type: :uuid
|
||||
|
||||
t.integer :uncap_level
|
||||
t.boolean :mainhand
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
class CreateWeaponKeys < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :weapon_keys, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :name_en
|
||||
t.string :name_jp
|
||||
|
||||
t.integer :series
|
||||
t.integer :type
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateDoorkeeperTables < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :oauth_applications, id: :uuid do |t|
|
||||
t.string :name, null: false
|
||||
t.string :uid, null: false
|
||||
t.string :secret, null: false
|
||||
t.text :redirect_uri, null: false
|
||||
t.string :scopes, null: false, default: ''
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
add_index :oauth_applications, :uid, unique: true
|
||||
|
||||
create_table :oauth_access_grants, id: :uuid do |t|
|
||||
t.uuid :resource_owner_id, null: false
|
||||
t.uuid :application_id, null: false
|
||||
t.string :token, null: false
|
||||
t.integer :expires_in, null: false
|
||||
t.text :redirect_uri, null: false
|
||||
t.datetime :created_at, null: false
|
||||
t.datetime :revoked_at
|
||||
t.string :scopes
|
||||
end
|
||||
|
||||
add_index :oauth_access_grants, :token, unique: true
|
||||
add_foreign_key(
|
||||
:oauth_access_grants,
|
||||
:oauth_applications,
|
||||
column: :application_id
|
||||
)
|
||||
|
||||
create_table :oauth_access_tokens, id: :uuid do |t|
|
||||
t.uuid :resource_owner_id
|
||||
t.uuid :application_id
|
||||
|
||||
# If you use a custom token generator you may need to change this column
|
||||
# from string to text, so that it accepts tokens larger than 255
|
||||
# characters. More info on custom token generators in:
|
||||
# https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
|
||||
#
|
||||
# t.text :token, null: false
|
||||
t.string :token, null: false
|
||||
|
||||
t.string :refresh_token
|
||||
t.integer :expires_in
|
||||
t.datetime :revoked_at
|
||||
t.datetime :created_at, null: false
|
||||
t.string :scopes
|
||||
|
||||
# If there is a previous_refresh_token column,
|
||||
# refresh tokens will be revoked after a related access token is used.
|
||||
# If there is no previous_refresh_token column,
|
||||
# previous tokens are revoked as soon as a new access token is created.
|
||||
# Comment out this line if you'd rather have refresh tokens
|
||||
# instantly revoked.
|
||||
t.string :previous_refresh_token, null: false, default: ""
|
||||
end
|
||||
|
||||
add_index :oauth_access_tokens, :token, unique: true
|
||||
add_index :oauth_access_tokens, :resource_owner_id
|
||||
add_index :oauth_access_tokens, :refresh_token, unique: true
|
||||
add_foreign_key(
|
||||
:oauth_access_tokens,
|
||||
:oauth_applications,
|
||||
column: :application_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
class CreateSummons < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :summons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :name_en
|
||||
t.string :name_jp
|
||||
t.string :granblue_id
|
||||
|
||||
t.integer :rarity
|
||||
t.integer :element
|
||||
t.string :series
|
||||
|
||||
t.boolean :flb
|
||||
t.boolean :ulb
|
||||
|
||||
t.integer :max_level
|
||||
t.integer :min_hp
|
||||
t.integer :max_hp
|
||||
t.integer :max_hp_flb
|
||||
t.integer :max_hp_ulb
|
||||
t.integer :min_atk
|
||||
t.integer :max_atk
|
||||
t.integer :max_atk_flb
|
||||
t.integer :max_atk_ulb
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
class CreateGridSummons < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :grid_summons, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.references :party, type: :uuid
|
||||
t.references :summon, type: :uuid
|
||||
|
||||
t.integer :uncap_level
|
||||
t.boolean :main
|
||||
t.boolean :friend
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
class CreateCharacters < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :characters, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :name_en
|
||||
t.string :name_jp
|
||||
t.string :granblue_id
|
||||
|
||||
t.integer :rarity
|
||||
t.integer :element
|
||||
t.integer :proficiency1
|
||||
t.integer :proficiency2
|
||||
t.integer :gender
|
||||
t.integer :race1
|
||||
t.integer :race2
|
||||
|
||||
t.boolean :flb
|
||||
t.boolean :max_level
|
||||
|
||||
t.integer :min_hp
|
||||
t.integer :max_hp
|
||||
t.integer :max_hp_flb
|
||||
t.integer :min_atk
|
||||
t.integer :max_atk
|
||||
t.integer :max_atk_flb
|
||||
|
||||
t.integer :base_da
|
||||
t.integer :base_ta
|
||||
t.float :ougi_ratio
|
||||
t.float :ougi_ratio_flb
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
class CreateGridCharacters < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :grid_characters do |t|
|
||||
t.references :party, type: :uuid
|
||||
t.references :character, type: :uuid
|
||||
|
||||
t.integer :uncap_level
|
||||
t.integer :position
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddExtraToParty < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :parties, :extra, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddExtraToWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapons, :extra, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddSubauraToSummons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :summons, :subaura, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddLimitsToWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapons, :limit, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddLimitsToSummons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :summons, :limit, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
class AddDefaultToLbOnWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
def self.up
|
||||
change_column :weapons, :flb, :boolean, default: false
|
||||
change_column :weapons, :ulb, :boolean, default: false
|
||||
end
|
||||
|
||||
def self.down
|
||||
change_column :weapons, :flb, :boolean, default: nil
|
||||
change_column :weapons, :ulb, :boolean, default: nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddAxToWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapons, :ax, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
class AddSpecialToCharacters < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
add_column :characters, :special, :boolean, :default => false
|
||||
change_column_null :characters, :special, false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :characters, :special, :boolean
|
||||
end
|
||||
end
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
class AddUlbToCharacters < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
add_column :characters, :ulb, :boolean, :default => false
|
||||
add_column :characters, :max_hp_ulb, :integer
|
||||
add_column :characters, :max_atk_ulb, :integer
|
||||
change_column_null :characters, :ulb, false
|
||||
change_column_null :characters, :flb, false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :characters, :ulb, :boolean
|
||||
remove_column :characters, :max_hp_ulb, :integer
|
||||
remove_column :characters, :max_atk_ulb, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class RemoveMaxLevelFromCharacters < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
remove_column :characters, :max_level, :boolean
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddUuidToGridCharacter < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :grid_characters, :uuid, :uuid, default: "gen_random_uuid()", null: false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
class ChangeGridCharacterIdToUuid < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
change_table :grid_characters do |t|
|
||||
t.remove :id
|
||||
t.rename :uuid, :id
|
||||
end
|
||||
|
||||
execute "ALTER TABLE grid_characters ADD PRIMARY KEY (id);"
|
||||
end
|
||||
end
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
class AddDetailsToParty < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :raids, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :name_en
|
||||
t.string :name_jp
|
||||
t.integer :level
|
||||
end
|
||||
|
||||
add_column :parties, :name, :string
|
||||
add_column :parties, :description, :text
|
||||
add_reference :parties, :raids, index: true
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddGroupToRaids < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :raids, :group, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class FixRaidAssociationOnParties < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :parties, :raid_id, :uuid
|
||||
remove_column :parties, :raids_id, :bigint
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddElementToRaids < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :raids, :element, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddElementToParties < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :parties, :element, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
class CreateFavorites < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :favorites, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.references :user, type: :uuid
|
||||
t.references :party, type: :uuid
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class ChangeWeaponSeriesToNumber < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
change_column :weapons, :series, 'integer USING CAST(element AS integer)'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class RemoveTimestampsFromWeaponKeys < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
remove_column :weapon_keys, :created_at, :datetime
|
||||
remove_column :weapon_keys, :updated_at, :datetime
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddSubTypeToWeaponKeys < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapon_keys, :subtype, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddWeaponKey3ToGridWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_reference :grid_weapons, :weapon_key3, type: :uuid, foreign_key: { to_table: :weapon_keys }
|
||||
end
|
||||
end
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
class AddAxToGridWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :grid_weapons, :ax_modifier1, :integer
|
||||
add_column :grid_weapons, :ax_strength1, :float
|
||||
add_column :grid_weapons, :ax_modifier2, :integer
|
||||
add_column :grid_weapons, :ax_strength2, :float
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddElementToGridWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :grid_weapons, :element, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddPerpetuityToGridCharacters < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :grid_characters, :perpetuity, :boolean
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class RenameTypeAndSubTypeInWeaponKeys < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
rename_column :weapon_keys, :type, :slot
|
||||
rename_column :weapon_keys, :subtype, :group
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddOrderToWeaponKeys < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :weapon_keys, :order, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
class AddFieldsToUser < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :users, :picture, :string
|
||||
add_column :users, :language, :string
|
||||
add_column :users, :private, :boolean
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
class AddDefaultValuesToUser < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
change_column :users, :picture, :string, :default => "gran"
|
||||
change_column :users, :language, :string, :default => "en"
|
||||
change_column :users, :private, :boolean, :default => false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class AddNotNullableToUser < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
change_column :users, :language, :string, :default => "en", :null => false
|
||||
change_column :users, :private, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddElementToUser < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :users, :element, :string, :default => "water", :null => false
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddSlugToRaids < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :raids, :slug, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
class AddGinIndexToWeapons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
enable_extension "pg_trgm"
|
||||
enable_extension "btree_gin"
|
||||
add_index :weapons, :name_en, using: :gin, opclass: :gin_trgm_ops
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class AddGinIndexToSummonsAndCharacters < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_index :summons, :name_en, using: :gin, opclass: :gin_trgm_ops
|
||||
add_index :characters, :name_en, using: :gin, opclass: :gin_trgm_ops
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddWeaponsCountToParties < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :parties, :weapons_count, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
class PopulatePartyWeaponsCount < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
Party.find_each do |party|
|
||||
Party.reset_counters(party.id, :weapons)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
class CreateClasses < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :classes, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.string :name_en
|
||||
t.string :name_jp
|
||||
|
||||
t.integer :proficiency1
|
||||
t.integer :proficiency2
|
||||
|
||||
t.string :row
|
||||
t.boolean :ml, default: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class AddClassAndMlToParty < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_reference :parties, :class, name: :class_id, type: :uuid, foreign_key: { to_table: :classes }
|
||||
add_column :parties, :ml, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class AddForeignKeyRelationsToParties < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_foreign_key :parties, :users
|
||||
add_foreign_key :parties, :raids
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class AddForeignKeyRelationsToFavorites < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_foreign_key :favorites, :users
|
||||
add_foreign_key :favorites, :parties
|
||||
end
|
||||
end
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
class AddForeignKeyRelationsToObjects < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_foreign_key :grid_characters, :parties
|
||||
add_foreign_key :grid_characters, :characters
|
||||
|
||||
add_foreign_key :grid_weapons, :parties
|
||||
add_foreign_key :grid_weapons, :weapons
|
||||
|
||||
add_foreign_key :grid_summons, :parties
|
||||
add_foreign_key :grid_summons, :summons
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
class AddDefaultPerpetuityToGridCharacters < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
GridCharacter.find_each do |char|
|
||||
char.perpetuity = false
|
||||
char.save!
|
||||
end
|
||||
|
||||
change_column :grid_characters, :perpetuity, :boolean, default: false, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
class AddDefaultsToCharacters < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
change_column :characters, :flb, :boolean, default: false, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
class AddDefaultsToWeapons < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
Weapon.find_each do |w|
|
||||
if w.flb.nil?
|
||||
w.flb = false
|
||||
w.save!
|
||||
end
|
||||
|
||||
if w.ulb.nil?
|
||||
w.ulb = false
|
||||
w.save!
|
||||
end
|
||||
end
|
||||
|
||||
change_column :weapons, :flb, :boolean, default: false, null: false
|
||||
change_column :weapons, :ulb, :boolean, default: false, null: false
|
||||
change_column :weapons, :ax, :integer, default: 0, null: false
|
||||
change_column :weapons, :series, :integer, default: -1, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
class AddDefaultsToSummons < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
def up
|
||||
Summon.find_each do |s|
|
||||
if s.flb.nil?
|
||||
s.flb = false
|
||||
s.save!
|
||||
end
|
||||
|
||||
if s.ulb.nil?
|
||||
s.ulb = false
|
||||
s.save!
|
||||
end
|
||||
end
|
||||
|
||||
change_column :summons, :flb, :boolean, default: false, null: false
|
||||
change_column :summons, :ulb, :boolean, default: false, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class ChangeClassesToJobs < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
rename_table :classes, :jobs
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class RenameClassIdToJobId < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
rename_column :parties, :class_id, :job_id
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddOrderToJobs < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :jobs, :order, :integer
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddGenderToUser < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :users, :gender, :integer, null: false, default: 0
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
class AddCharacterIdToCharacters < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :characters, :character_id, :integer, array: true, null: false, default: []
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
class AddJobSkillsTable < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :job_skills, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
|
||||
t.references :job, type: :uuid
|
||||
t.string :name_en, null: false, unique: true
|
||||
t.string :name_jp, null: false, unique: true
|
||||
t.string :slug, null: false, unique: true
|
||||
t.integer :color, null: false
|
||||
t.boolean :main, default: false
|
||||
t.boolean :sub, default: false
|
||||
t.boolean :emp, default: false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class RemoveNullConstraintFromJobSkills < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
change_column :job_skills, :name_en, :string, unique: false
|
||||
change_column :job_skills, :name_jp, :string, unique: false
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue