From 6cd75f8f16cb3ed9a2f7fcf22ee6747dea5b571b Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 03:19:15 -0800 Subject: [PATCH 1/6] Add new party details to database --- db/migrate/20230103111523_add_new_party_details.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 db/migrate/20230103111523_add_new_party_details.rb diff --git a/db/migrate/20230103111523_add_new_party_details.rb b/db/migrate/20230103111523_add_new_party_details.rb new file mode 100644 index 0000000..1d2b4b7 --- /dev/null +++ b/db/migrate/20230103111523_add_new_party_details.rb @@ -0,0 +1,12 @@ +class AddNewPartyDetails < ActiveRecord::Migration[7.0] + def change + add_column :parties, :full_auto, :boolean, default: false, null: false + add_column :parties, :auto_guard, :boolean, default: false, null: false + add_column :parties, :charge_attack, :boolean, default: false, null: false + + add_column :parties, :clear_time, :integer, default: 0, null: false + add_column :parties, :button_count, :integer, default: 0, null: false + add_column :parties, :chain_count, :integer, default: 0, null: false + add_column :parties, :turn_count, :integer, default: 0, null: false + end +end From 2cfaf0c1cf38c68a0513dded6f16cec4817141a8 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 08:05:03 -0800 Subject: [PATCH 2/6] Add ruby-gemset and update Gemfile.lock --- .ruby-gemset | 1 + Gemfile.lock | 81 ++++++++++++++++++++++++++++------------------------ 2 files changed, 44 insertions(+), 38 deletions(-) create mode 100644 .ruby-gemset diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 0000000..f3876a4 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +granblue diff --git a/Gemfile.lock b/Gemfile.lock index 1e2acdf..62087bc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -71,7 +71,7 @@ GEM activesupport (>= 3.2.5) nokogiri (>= 1.5.2) rspec (>= 3.1) - apipie-rails (0.8.2) + apipie-rails (0.9.0) actionpack (>= 5.0) activesupport (>= 5.0) ast (2.4.2) @@ -79,9 +79,9 @@ GEM activerecord (>= 4.0.0, < 7.1) backport (1.2.0) bcrypt (3.1.18) - benchmark (0.2.0) + benchmark (0.2.1) blueprinter (0.25.3) - bootsnap (1.13.0) + bootsnap (1.15.0) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) @@ -96,9 +96,10 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) + date (3.3.3) diff-lcs (1.5.0) docile (1.4.0) - doorkeeper (5.6.0) + doorkeeper (5.6.2) railties (>= 5) dotenv (2.8.1) dotenv-rails (2.8.1) @@ -107,18 +108,18 @@ GEM e2mmap (0.1.0) email_validator (2.2.4) activemodel - erubi (1.11.0) + erubi (1.12.0) factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (3.0.0) + faker (3.1.0) i18n (>= 1.8.11, < 2) ffi (1.15.5) figaro (1.2.0) thor (>= 0.14.0, < 2) - gemoji (3.0.1) + gemoji (4.0.1) gemoji-parser (1.3.1) gemoji (>= 2.1.0) globalid (1.0.0) @@ -126,7 +127,7 @@ GEM i18n (1.12.0) concurrent-ruby (~> 1.0) jaro_winkler (1.5.4) - json (2.6.2) + json (2.6.3) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -134,43 +135,47 @@ GEM listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.19.0) + loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.0) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) - mini_portile2 (2.6.1) - minitest (5.16.3) + mini_portile2 (2.8.1) + minitest (5.17.0) msgpack (1.6.0) - net-imap (0.3.1) + net-imap (0.3.4) + date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.1) timeout net-smtp (0.3.3) net-protocol nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.10) + mini_portile2 (~> 2.8.0) racc (~> 1.4) oj (3.13.23) parallel (1.22.1) - parser (3.1.2.1) + parser (3.2.0.0) ast (~> 2.4.1) - pg (1.4.4) + pg (1.4.5) pg_search (2.3.6) activerecord (>= 5.2) activesupport (>= 5.2) - psych (4.0.6) + psych (5.0.1) stringio - puma (6.0.0) + puma (6.0.2) nio4r (~> 2.0) - racc (1.6.0) - rack (2.2.4) + racc (1.6.2) + rack (2.2.5) rack-cors (1.1.1) rack (>= 2.0.0) rack-test (2.0.2) @@ -192,8 +197,8 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) + rails-html-sanitizer (1.4.4) + loofah (~> 2.19, >= 2.19.1) railties (7.0.4) actionpack (= 7.0.4) activesupport (= 7.0.4) @@ -206,9 +211,9 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.4.0) + rdoc (6.5.0) psych (>= 4.0.0) - regexp_parser (2.6.0) + regexp_parser (2.6.1) responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) @@ -221,10 +226,10 @@ GEM rspec-mocks (~> 3.12.0) rspec-core (3.12.0) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-mocks (3.12.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (6.0.1) @@ -238,30 +243,30 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.38.0) + rubocop (1.42.0) json (~> 2.3) parallel (~> 1.10) parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.24.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) + rubocop-ast (1.24.1) parser (>= 3.1.1.0) ruby-progressbar (1.11.0) - sdoc (2.4.0) + sdoc (2.5.0) rdoc (>= 5.0) - shoulda-matchers (5.2.0) + shoulda-matchers (5.3.0) activesupport (>= 5.2.0) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - solargraph (0.47.2) + solargraph (0.48.0) backport (~> 1.2) benchmark bundler (>= 1.17.2) @@ -279,13 +284,13 @@ GEM spring (4.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) - stringio (3.0.2) + stringio (3.0.4) thor (1.2.1) tilt (2.0.11) - timeout (0.3.0) + timeout (0.3.1) tzinfo (2.0.5) concurrent-ruby (~> 1.0) - unicode-display_width (2.3.0) + unicode-display_width (2.4.0) webrick (1.7.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) From 09973142e2307e92f6af61778af3104b358c8a1f Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 08:05:16 -0800 Subject: [PATCH 3/6] Update default value for turn count to 1 --- .../20230103150807_update_turn_count_default.rb | 5 +++++ db/schema.rb | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20230103150807_update_turn_count_default.rb diff --git a/db/migrate/20230103150807_update_turn_count_default.rb b/db/migrate/20230103150807_update_turn_count_default.rb new file mode 100644 index 0000000..c1bdfcd --- /dev/null +++ b/db/migrate/20230103150807_update_turn_count_default.rb @@ -0,0 +1,5 @@ +class UpdateTurnCountDefault < ActiveRecord::Migration[7.0] + def change + change_column :parties, :turn_count, :integer, null: false, default: 1 + end +end diff --git a/db/schema.rb b/db/schema.rb index 84e3855..1c00aa4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,13 +10,12 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_01_02_235042) do +ActiveRecord::Schema[7.0].define(version: 2023_01_03_150807) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_trgm" enable_extension "pgcrypto" enable_extension "plpgsql" - enable_extension "timescaledb" create_table "characters", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name_en" @@ -119,9 +118,6 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_02_235042) do t.integer "awakening_level", default: 1, null: false t.index ["party_id"], name: "index_grid_weapons_on_party_id" t.index ["weapon_id"], name: "index_grid_weapons_on_weapon_id" - t.index ["weapon_key1_id"], name: "index_grid_weapons_on_weapon_key1_id" - t.index ["weapon_key2_id"], name: "index_grid_weapons_on_weapon_key2_id" - t.index ["weapon_key3_id"], name: "index_grid_weapons_on_weapon_key3_id" end create_table "job_skills", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| @@ -205,6 +201,13 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_02_235042) do t.uuid "skill2_id" t.uuid "skill3_id" t.uuid "skill0_id" + t.boolean "full_auto", default: false, null: false + t.boolean "auto_guard", default: false, null: false + t.boolean "charge_attack", default: false, null: false + t.integer "clear_time", default: 0, null: false + t.integer "button_count", default: 0, null: false + t.integer "chain_count", default: 0, null: false + t.integer "turn_count", default: 1, null: false 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" From 3226acdf4a8bafab72bc58e77862fe4d3975842d Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 08:05:47 -0800 Subject: [PATCH 4/6] Allow input of expanded details and output them --- app/blueprints/api/v1/party_blueprint.rb | 5 +++-- app/controllers/api/v1/parties_controller.rb | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/blueprints/api/v1/party_blueprint.rb b/app/blueprints/api/v1/party_blueprint.rb index db539fd..be3635e 100644 --- a/app/blueprints/api/v1/party_blueprint.rb +++ b/app/blueprints/api/v1/party_blueprint.rb @@ -33,7 +33,8 @@ module Api end view :minimal do - fields :name, :element, :shortcode, :favorited, :extra, :created_at, :updated_at + fields :name, :element, :shortcode, :favorited, :extra, + :full_auto, :clear_time, :auto_guard, :created_at, :updated_at association :raid, blueprint: RaidBlueprint @@ -63,7 +64,7 @@ module Api include_view :characters include_view :job_skills - fields :description, :extra + fields :description, :charge_attack, :button_count, :turn_count, :chain_count end view :collection do diff --git a/app/controllers/api/v1/parties_controller.rb b/app/controllers/api/v1/parties_controller.rb index e6494fb..88d0953 100644 --- a/app/controllers/api/v1/parties_controller.rb +++ b/app/controllers/api/v1/parties_controller.rb @@ -105,7 +105,7 @@ module Api def build_conditions(params) unless params['recency'].blank? start_time = (DateTime.current - params['recency'].to_i.seconds) - .to_datetime.beginning_of_day + .to_datetime.beginning_of_day end {}.tap do |hash| @@ -142,7 +142,14 @@ module Api :skill0_id, :skill1_id, :skill2_id, - :skill3_id + :skill3_id, + :full_auto, + :auto_guard, + :charge_attack, + :clear_time, + :button_count, + :turn_count, + :chain_count ) end end From d505b35861ea4da210995d6fccbe10807fbc4a6d Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 18:06:57 -0800 Subject: [PATCH 5/6] Update properties of new fields again --- .../20230103175004_update_nullable_on_party_details.rb | 7 +++++++ ...0103180458_change_default_value_on_charge_attack.rb | 5 +++++ db/schema.rb | 10 +++++----- 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20230103175004_update_nullable_on_party_details.rb create mode 100644 db/migrate/20230103180458_change_default_value_on_charge_attack.rb diff --git a/db/migrate/20230103175004_update_nullable_on_party_details.rb b/db/migrate/20230103175004_update_nullable_on_party_details.rb new file mode 100644 index 0000000..59d9479 --- /dev/null +++ b/db/migrate/20230103175004_update_nullable_on_party_details.rb @@ -0,0 +1,7 @@ +class UpdateNullableOnPartyDetails < ActiveRecord::Migration[7.0] + def change + change_column :parties, :button_count, :integer, null: true, default: nil + change_column :parties, :chain_count, :integer, null: true, default: nil + change_column :parties, :turn_count, :integer, null: true, default: nil + end +end diff --git a/db/migrate/20230103180458_change_default_value_on_charge_attack.rb b/db/migrate/20230103180458_change_default_value_on_charge_attack.rb new file mode 100644 index 0000000..7526a69 --- /dev/null +++ b/db/migrate/20230103180458_change_default_value_on_charge_attack.rb @@ -0,0 +1,5 @@ +class ChangeDefaultValueOnChargeAttack < ActiveRecord::Migration[7.0] + def change + change_column :parties, :charge_attack, :boolean, null: false, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 1c00aa4..0b5c6cb 100644 --- a/db/schema.rb +++ b/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_01_03_150807) do +ActiveRecord::Schema[7.0].define(version: 2023_01_03_180458) do # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" enable_extension "pg_trgm" @@ -203,11 +203,11 @@ ActiveRecord::Schema[7.0].define(version: 2023_01_03_150807) do t.uuid "skill0_id" t.boolean "full_auto", default: false, null: false t.boolean "auto_guard", default: false, null: false - t.boolean "charge_attack", default: false, null: false + t.boolean "charge_attack", default: true, null: false t.integer "clear_time", default: 0, null: false - t.integer "button_count", default: 0, null: false - t.integer "chain_count", default: 0, null: false - t.integer "turn_count", default: 1, null: false + t.integer "button_count" + t.integer "chain_count" + t.integer "turn_count" 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" From da24ab29427d47abc8c1d37588382d571a4d2bd7 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 3 Jan 2023 18:07:04 -0800 Subject: [PATCH 6/6] Update defaults to Rails 7.0 --- config/application.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index 003ff00..91ad666 100644 --- a/config/application.rb +++ b/config/application.rb @@ -20,7 +20,7 @@ Bundler.require(*Rails.groups) module HenseiApi class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 + config.load_defaults 7.0 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers