Change to individual guidebook columns
This commit is contained in:
parent
7de8594bf1
commit
bc33d7cca6
6 changed files with 52 additions and 3 deletions
|
|
@ -40,6 +40,14 @@ module Api
|
|||
p.is_remix
|
||||
end
|
||||
|
||||
field :guidebooks do |p|
|
||||
{
|
||||
'0' => !p.guidebook0.nil? ? GuidebookBlueprint.render_as_hash(p.guidebook0) : nil,
|
||||
'1' => !p.guidebook1.nil? ? GuidebookBlueprint.render_as_hash(p.guidebook1) : nil,
|
||||
'2' => !p.guidebook2.nil? ? GuidebookBlueprint.render_as_hash(p.guidebook2) : nil
|
||||
}
|
||||
end
|
||||
|
||||
association :raid,
|
||||
blueprint: RaidBlueprint
|
||||
|
||||
|
|
|
|||
|
|
@ -241,6 +241,8 @@ module Api
|
|||
end
|
||||
|
||||
def party_params
|
||||
ap "Params are..."
|
||||
ap params
|
||||
return unless params[:party].present?
|
||||
|
||||
params.require(:party).permit(
|
||||
|
|
@ -263,7 +265,10 @@ module Api
|
|||
:clear_time,
|
||||
:button_count,
|
||||
:turn_count,
|
||||
:chain_count
|
||||
:chain_count,
|
||||
:guidebook0_id,
|
||||
:guidebook1_id,
|
||||
:guidebook2_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -41,6 +41,21 @@ class Party < ApplicationRecord
|
|||
class_name: 'JobSkill',
|
||||
optional: true
|
||||
|
||||
belongs_to :guidebook0,
|
||||
foreign_key: 'guidebook0_id',
|
||||
class_name: 'Guidebook',
|
||||
optional: true
|
||||
|
||||
belongs_to :guidebook1,
|
||||
foreign_key: 'guidebook1_id',
|
||||
class_name: 'Guidebook',
|
||||
optional: true
|
||||
|
||||
belongs_to :guidebook2,
|
||||
foreign_key: 'guidebook2_id',
|
||||
class_name: 'Guidebook',
|
||||
optional: true
|
||||
|
||||
has_many :characters,
|
||||
foreign_key: 'party_id',
|
||||
class_name: 'GridCharacter',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class RenameGuidebooksToGuidebookIDs < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
rename_column :parties, :guidebooks, :guidebook_ids
|
||||
end
|
||||
end
|
||||
8
db/migrate/20230419033648_split_guidebooks_on_party.rb
Normal file
8
db/migrate/20230419033648_split_guidebooks_on_party.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
class SplitGuidebooksOnParty < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
remove_column :parties, :guidebook_ids
|
||||
add_reference :parties, :guidebook0, type: :uuid, foreign_key: { to_table: :guidebooks }
|
||||
add_reference :parties, :guidebook1, type: :uuid, foreign_key: { to_table: :guidebooks }
|
||||
add_reference :parties, :guidebook2, type: :uuid, foreign_key: { to_table: :guidebooks }
|
||||
end
|
||||
end
|
||||
12
db/schema.rb
12
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_04_18_061932) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_04_19_033648) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "btree_gin"
|
||||
enable_extension "pg_trgm"
|
||||
|
|
@ -306,8 +306,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_18_061932) do
|
|||
t.string "edit_key"
|
||||
t.uuid "local_id"
|
||||
t.integer "ultimate_mastery"
|
||||
t.uuid "guidebooks", default: [], null: false, array: true
|
||||
t.uuid "guidebook0_id"
|
||||
t.uuid "guidebook1_id"
|
||||
t.uuid "guidebook2_id"
|
||||
t.index ["accessory_id"], name: "index_parties_on_accessory_id"
|
||||
t.index ["guidebook0_id"], name: "index_parties_on_guidebook0_id"
|
||||
t.index ["guidebook1_id"], name: "index_parties_on_guidebook1_id"
|
||||
t.index ["guidebook2_id"], name: "index_parties_on_guidebook2_id"
|
||||
t.index ["job_id"], name: "index_parties_on_job_id"
|
||||
t.index ["skill0_id"], name: "index_parties_on_skill0_id"
|
||||
t.index ["skill1_id"], name: "index_parties_on_skill1_id"
|
||||
|
|
@ -423,6 +428,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_18_061932) do
|
|||
add_foreign_key "jobs", "jobs", column: "base_job_id"
|
||||
add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id"
|
||||
add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id"
|
||||
add_foreign_key "parties", "guidebooks", column: "guidebook0_id"
|
||||
add_foreign_key "parties", "guidebooks", column: "guidebook1_id"
|
||||
add_foreign_key "parties", "guidebooks", column: "guidebook2_id"
|
||||
add_foreign_key "parties", "job_accessories", column: "accessory_id"
|
||||
add_foreign_key "parties", "job_skills", column: "skill0_id"
|
||||
add_foreign_key "parties", "job_skills", column: "skill1_id"
|
||||
|
|
|
|||
Loading…
Reference in a new issue