Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup factories and annotate them, drop partner users table #4536

Merged
merged 7 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -781,4 +781,4 @@ DEPENDENCIES
webmock (~> 3.23)

BUNDLED WITH
2.5.14
2.5.15
9 changes: 9 additions & 0 deletions db/migrate/20240718010905_drop_partner_users_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class DropPartnerUsersTable < ActiveRecord::Migration[7.1]
def up
drop_table :partner_users

end
def down
fail ActiveRecord::IrreversibleMigration
end
end
34 changes: 1 addition & 33 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_07_04_214509) do
ActiveRecord::Schema[7.1].define(version: 2024_07_18_010905) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -630,38 +630,6 @@
t.index ["partner_profile_id"], name: "index_partner_served_areas_on_partner_profile_id"
end

create_table "partner_users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at", precision: nil
t.datetime "remember_created_at", precision: nil
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at", precision: nil
t.datetime "last_sign_in_at", precision: nil
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at", precision: nil, null: false
t.datetime "updated_at", precision: nil, null: false
t.string "invitation_token"
t.datetime "invitation_created_at", precision: nil
t.datetime "invitation_sent_at", precision: nil
t.datetime "invitation_accepted_at", precision: nil
t.integer "invitation_limit"
t.string "invited_by_type"
t.bigint "invited_by_id"
t.integer "invitations_count", default: 0
t.bigint "partner_id"
t.string "name"
t.index ["email"], name: "index_partner_users_on_email", unique: true
t.index ["invitation_token"], name: "index_partner_users_on_invitation_token", unique: true
t.index ["invitations_count"], name: "index_partner_users_on_invitations_count"
t.index ["invited_by_id"], name: "index_partner_users_on_invited_by_id"
t.index ["invited_by_type", "invited_by_id"], name: "index_partner_users_on_invited_by"
t.index ["partner_id"], name: "index_partner_users_on_partner_id"
t.index ["reset_password_token"], name: "index_partner_users_on_reset_password_token", unique: true
end

create_table "partners", id: :serial, force: :cascade do |t|
t.string "name"
t.string "email"
Expand Down
11 changes: 0 additions & 11 deletions spec/factories/donation_site.rb

This file was deleted.

28 changes: 28 additions & 0 deletions spec/factories/donation_sites.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# == Schema Information
#
# Table name: donation_sites
#
# id :integer not null, primary key
# active :boolean default(TRUE)
# address :string
# contact_name :string
# email :string
# latitude :float
# longitude :float
# name :string
# phone :string
# created_at :datetime not null
# updated_at :datetime not null
# organization_id :integer
#
FactoryBot.define do
factory :donation_site do
organization { Organization.try(:first) || create(:organization) }
name { Faker::Company.name }
address { "1500 Remount Road, Front Royal, VA 22630" }
active { true }
contact_name { Faker::Name.name }
email { Faker::Internet.email }
phone { Faker::PhoneNumber.phone_number }
end
end
16 changes: 0 additions & 16 deletions spec/factories/partner_user.rb

This file was deleted.

14 changes: 0 additions & 14 deletions spec/factories/partners/child.rb

This file was deleted.

35 changes: 35 additions & 0 deletions spec/factories/partners/children.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# == Schema Information
#
# Table name: children
#
# id :bigint not null, primary key
# active :boolean default(TRUE)
# archived :boolean
# child_lives_with :jsonb
# comments :text
# date_of_birth :date
# first_name :string
# gender :string
# health_insurance :jsonb
# item_needed_diaperid :integer
# last_name :string
# race :jsonb
# created_at :datetime not null
# updated_at :datetime not null
# agency_child_id :string
# family_id :bigint
#
FactoryBot.define do
factory :partners_child, class: Partners::Child do
association :family, factory: :partners_family

active { true }
archived { false }
comments { "Comments " }
date_of_birth { Time.zone.today - 5.years }
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
gender { Faker::Gender.binary_type }
requested_item_ids { [create(:item, organization: family.partner.organization).id] }
end
end
49 changes: 49 additions & 0 deletions spec/factories/partners/families.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# == Schema Information
#
# Table name: families
#
# id :bigint not null, primary key
# archived :boolean default(FALSE)
# case_manager :string
# comments :text
# guardian_county :string
# guardian_employed :boolean
# guardian_employment_type :jsonb
# guardian_first_name :string
# guardian_health_insurance :jsonb
# guardian_last_name :string
# guardian_monthly_pay :decimal(, )
# guardian_phone :string
# guardian_zip_code :string
# home_adult_count :integer
# home_child_count :integer
# home_young_child_count :integer
# military :boolean default(FALSE)
# sources_of_income :jsonb
# created_at :datetime not null
# updated_at :datetime not null
# old_partner_id :bigint
# partner_id :bigint
#
FactoryBot.define do
factory :partners_family, class: Partners::Family do
association :partner

comments { Faker::Lorem.paragraph }
# Faker doesn't have county, community is same flavour, we don't use it, and it is not country.
guardian_county { Faker::Address.community }
guardian_employed { false }
guardian_employment_type { nil }
guardian_first_name { Faker::Name.first_name }
guardian_health_insurance { nil }
guardian_last_name { Faker::Name.last_name }
guardian_monthly_pay { rand(500.0..2000.0).round(2) }
guardian_phone { Faker::PhoneNumber.phone_number_with_country_code }
guardian_zip_code { Faker::Address.zip }
home_adult_count { rand(1..5) }
home_child_count { rand(0..5) }
home_young_child_count { rand(0..5) }
military { false }
archived { false }
end
end
22 changes: 0 additions & 22 deletions spec/factories/partners/family.rb

This file was deleted.

9 changes: 0 additions & 9 deletions spec/factories/partners/item_request.rb

This file was deleted.

24 changes: 24 additions & 0 deletions spec/factories/partners/item_requests.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# == Schema Information
#
# Table name: item_requests
#
# id :bigint not null, primary key
# name :string
# partner_key :string
# quantity :string
# request_unit :string
# created_at :datetime not null
# updated_at :datetime not null
# item_id :integer
# old_partner_request_id :integer
# partner_request_id :bigint
#
FactoryBot.define do
factory :item_request, class: Partners::ItemRequest do
item
request { build(:request, organization: item.organization) }
quantity { 5 }
sequence(:name) { |n| "Item Request #{n}" }
sequence(:partner_key) { |n| "partner_key#{n}" }
end
end
9 changes: 0 additions & 9 deletions spec/factories/partners/profile.rb

This file was deleted.

90 changes: 90 additions & 0 deletions spec/factories/partners/profiles.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# == Schema Information
#
# Table name: partner_profiles
#
# id :bigint not null, primary key
# above_1_2_times_fpl :integer
# address1 :string
# address2 :string
# agency_mission :text
# agency_type :string
# application_data :text
# at_fpl_or_below :integer
# case_management :boolean
# city :string
# client_capacity :string
# currently_provide_diapers :boolean
# describe_storage_space :text
# distribution_times :string
# distributor_type :string
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# essentials_budget :string
# essentials_funding_source :string
# essentials_use :string
# evidence_based :boolean
# executive_director_email :string
# executive_director_name :string
# executive_director_phone :string
# facebook :string
# form_990 :boolean
# founded :integer
# greater_2_times_fpl :integer
# income_requirement_desc :boolean
# income_verification :boolean
# instagram :string
# more_docs_required :string
# name :string
# new_client_times :string
# no_social_media_presence :boolean
# other_agency_type :string
# partner_status :string default("pending")
# pick_up_email :string
# pick_up_name :string
# pick_up_phone :string
# population_american_indian :integer
# population_asian :integer
# population_black :integer
# population_hispanic :integer
# population_island :integer
# population_multi_racial :integer
# population_other :integer
# population_white :integer
# poverty_unknown :integer
# primary_contact_email :string
# primary_contact_mobile :string
# primary_contact_name :string
# primary_contact_phone :string
# program_address1 :string
# program_address2 :string
# program_age :string
# program_city :string
# program_description :text
# program_name :string
# program_state :string
# program_zip_code :integer
# receives_essentials_from_other :string
# sources_of_diapers :string
# sources_of_funding :string
# state :string
# status_in_diaper_base :string
# storage_space :boolean
# twitter :string
# website :string
# zip_code :string
# zips_served :string
# created_at :datetime not null
# updated_at :datetime not null
# essentials_bank_id :bigint
# partner_id :integer
#
FactoryBot.define do
factory :partner_profile, class: Partners::Profile do
partner { Partner.first || create(:partner) }
essentials_bank_id { Organization.try(:first).id || create(:organization).id }
website { "http://some-site.org" }
primary_contact_email { Faker::Internet.email }
primary_contact_name { Faker::Name.name }
end
end
16 changes: 0 additions & 16 deletions spec/factories/partners/user.rb

This file was deleted.

Loading