Skip to content

Commit

Permalink
Merge branch 'master' into arf.80297/ARP-OGC-number-migrations
Browse files Browse the repository at this point in the history
* master:
  creates data to seed dev & staging (#16502)
  post database updates (#16500)
  Added auth-only feature flipper for 10-10EZR (#16496)
  update vsoreloader to correctly upsert organization data (#16470)
  database updates (#16475)
  Bump super_diff from 0.11.0 to 0.12.0 (#16495)
  • Loading branch information
gabezurita committed Apr 25, 2024
2 parents c6f1621 + c2cc95b commit 3c2ed1c
Show file tree
Hide file tree
Showing 40 changed files with 632 additions and 71 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ GEM
stringio (3.1.0)
strong_migrations (1.8.0)
activerecord (>= 5.2)
super_diff (0.11.0)
super_diff (0.12.0)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff
Expand Down
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ features:
actor_type: user
description: Enables Toxic Exposure questions for 10-10EZR applicants.
enable_in_development: true
ezr_auth_only_enabled:
actor_type: user
description: Enables the auth-only experience, allowing only authenticated users to view any part of the form.
enable_in_development: true
cerner_override_653:
actor_type: user
description: This will show the Cerner facility 653 as `isCerner`.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This migration comes from vye (originally 20240303145700)
class RemoveSsnAndIcnFromVyeTables < ActiveRecord::Migration[7.0]
def change
safety_assured do
remove_columns(
:vye_user_infos,
:icn,
:ssn_ciphertext,
:ssn_digest
)

remove_columns(
:vye_pending_documents,
:claim_no_ciphertext,
:ssn_ciphertext,
:ssn_digest
)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This migration comes from vye (originally 20240305034315)
class RemoveAddressDetailsFromVyeUserInfos < ActiveRecord::Migration[7.0]
def change
safety_assured do
remove_columns(
:vye_user_infos,
:full_name_ciphertext,
:address_line2_ciphertext,
:address_line3_ciphertext,
:address_line4_ciphertext,
:address_line5_ciphertext,
:address_line6_ciphertext,
:zip_ciphertext
)
end
end
end
16 changes: 16 additions & 0 deletions db/migrate/20240424132508_change_datetime_to_date.vye.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This migration comes from vye (originally 20240415205522)
class ChangeDatetimeToDate < ActiveRecord::Migration[7.1]
def change
safety_assured do
change_column :vye_awards, :award_begin_date, :date
change_column :vye_awards, :award_end_date, :date
change_column :vye_awards, :payment_date, :date

change_column :vye_pending_documents, :queue_date, :date

change_column :vye_user_infos, :cert_issue_date, :date
change_column :vye_user_infos, :del_date, :date
change_column :vye_user_infos, :date_last_certified, :date
end
end
end
15 changes: 15 additions & 0 deletions db/migrate/20240424132509_update_verifications.vye.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This migration comes from vye (originally 20240415220728)
class UpdateVerifications < ActiveRecord::Migration[7.1]
disable_ddl_transaction!

def change
add_column :vye_verifications, :user_profile_id, :integer
add_column :vye_verifications, :monthly_rate, :decimal
add_column :vye_verifications, :number_hours, :integer
add_column :vye_verifications, :payment_date, :date
add_column :vye_verifications, :transact_date, :date
add_column :vye_verifications, :trace, :string

add_index :vye_verifications, :user_profile_id, algorithm: :concurrently
end
end
15 changes: 15 additions & 0 deletions db/migrate/20240424132510_create_vye_bdn_clones.vye.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This migration comes from vye (originally 20240422033815)
class CreateVyeBdnClones < ActiveRecord::Migration[7.1]
def change
create_table :vye_bdn_clones do |t|
t.boolean :is_active
t.boolean :export_ready
t.date :transact_date

t.timestamps
end

add_index :vye_bdn_clones, :is_active, unique: true, where: "is_active IS NOT NULL"
add_index :vye_bdn_clones, :export_ready, unique: true, where: "export_ready IS NOT NULL"
end
end
14 changes: 14 additions & 0 deletions db/migrate/20240424132511_add_to_vye_user_infos.vye.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This migration comes from vye (originally 20240422043836)
class AddToVyeUserInfos < ActiveRecord::Migration[7.1]
disable_ddl_transaction!

def change
add_column :vye_user_infos, :bdn_clone_id, :integer
add_column :vye_user_infos, :bdn_clone_line, :integer
add_column :vye_user_infos, :bdn_clone_active, :boolean

add_index :vye_user_infos, :bdn_clone_id, algorithm: :concurrently
add_index :vye_user_infos, :bdn_clone_line, algorithm: :concurrently
add_index :vye_user_infos, :bdn_clone_active, algorithm: :concurrently
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This migration comes from vye (originally 20240422051918)
class RemoveFromVyePendingDocument < ActiveRecord::Migration[7.1]
def change
safety_assured do
remove_column :vye_pending_documents, :encrypted_kms_key
end
end
end
56 changes: 31 additions & 25 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion modules/veteran/app/sidekiq/veteran/vso_reloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def reload_vso_reps
state: vso_rep['Org State']
}
end.compact.uniq
Veteran::Service::Organization.import(vso_orgs, on_duplicate_key_ignore: true)
Veteran::Service::Organization.import(vso_orgs, on_duplicate_key_update: %i[name phone state])

vso_reps
end
Expand Down
23 changes: 23 additions & 0 deletions modules/veteran/spec/sidekiq/veteran/vso_reloader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,29 @@
end
end

context 'existing organizations' do
let(:org) do
create(:organization, poa: '091', name: 'Testing', phone: '222-555-5555', state: 'ZZ', city: 'New York')
end

it 'only updates name, phone, and state' do
VCR.use_cassette('veteran/ogc_vso_rep_data') do
expect(org.name).to eq('Testing')
expect(org.phone).to eq('222-555-5555')
expect(org.state).to eq('ZZ')
expect(org.city).to eq('New York')

Veteran::VSOReloader.new.reload_vso_reps
org.reload

expect(org.name).to eq('African American PTSD Association')
expect(org.phone).to eq('253-589-0766')
expect(org.state).to eq('WA')
expect(org.city).to eq('New York')
end
end
end

describe "storing a VSO's middle initial" do
it 'stores the middle initial if it exists' do
VCR.use_cassette('veteran/ogc_vso_rep_data') do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class Vye::V1::VerificationsController < Vye::V1::ApplicationController
def create
authorize user_info, policy_class: UserInfoPolicy

user_info.verifications.create!(source_ind:)
award = user_info.awards.first
user_profile = user_info.user_profile
Verification.create!(source_ind:, award:, user_profile:)
end

private
Expand Down
12 changes: 11 additions & 1 deletion modules/vye/app/models/vye/address_change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ class Vye::AddressChange < ApplicationRecord
presence: true, if: -> { origin == 'backend' }
)

enum origin: { frontend: 'f', backend: 'b' }
enum origin: {

frontend: 'f',

# This is a special case where the record was created on the frontend
# but will not have been reflected from the backend yet
cached: 'c',

backend: 'b'

}

scope :created_today, lambda {
includes(user_info: :user_profile)
Expand Down
1 change: 1 addition & 0 deletions modules/vye/app/models/vye/award.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Vye
class Vye::Award < ApplicationRecord
belongs_to :user_info
has_many :verifications, dependent: :nullify

enum cur_award_ind: { current: 'C', future: 'F', past: 'P' }

Expand Down
4 changes: 4 additions & 0 deletions modules/vye/app/models/vye/bdn_clone.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# frozen_string_literal: true

class Vye::BdnClone < ApplicationRecord
end
2 changes: 1 addition & 1 deletion modules/vye/app/models/vye/pending_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Vye
class Vye::PendingDocument < ApplicationRecord
self.ignored_columns += %i[claim_no_ciphertext ssn_ciphertext ssn_digest]
self.ignored_columns += %i[claim_no_ciphertext encrypted_kms_key ssn_ciphertext ssn_digest]

belongs_to :user_profile

Expand Down
11 changes: 5 additions & 6 deletions modules/vye/app/models/vye/user_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ class Vye::UserInfo < ApplicationRecord
has_many :address_changes, dependent: :destroy
has_many :awards, dependent: :destroy
has_many :direct_deposit_changes, dependent: :destroy
has_many :verifications, dependent: :destroy

scope :with_bdn_clone_active, -> { where(bdn_clone_active: true) }

enum mr_status: { active: 'A', expired: 'E' }
enum indicator: { chapter1606: 'A', chapter1607: 'E', chapter30: 'B', D: 'D' }

delegate :icn, to: :user_profile, allow_nil: true
delegate :pending_documents, to: :user_profile, allow_nil: true
delegate :ssn, to: :mpi_profile, allow_nil: true
delegate :pending_documents, to: :user_profile
delegate :verifications, to: :user_profile

has_kms_key
has_encrypted(:dob, :file_number, :stub_nm, key: :kms_key, **lockbox_options)
Expand All @@ -43,10 +46,6 @@ def verification_required
verifications.empty?
end

def ssn
mpi_profile&.ssn
end

private

def mpi_profile
Expand Down
Loading

0 comments on commit 3c2ed1c

Please sign in to comment.