Browse Source

Update seeds (#2095)

pull/2100/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
ae2c52edb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 92
      db/seeds.rb

92
db/seeds.rb

@ -40,14 +40,14 @@ unless Rails.env.test?
provider_type: "LA", provider_type: "LA",
) )
managing_agent1 = Organisation.find_or_create_by!( managing_agent1 = Organisation.find_or_create_by!(
name: "Managing Agent 1", name: "Managing Agent 1 (PRP)",
address_line1: "2 Marsham Street", address_line1: "2 Marsham Street",
address_line2: "London", address_line2: "London",
postcode: "SW1P 4DF", postcode: "SW1P 4DF",
holds_own_stock: true, holds_own_stock: true,
other_stock_owners: "None", other_stock_owners: "None",
managing_agents_label: "None", managing_agents_label: "None",
provider_type: "LA", provider_type: "PRP",
) )
managing_agent2 = Organisation.find_or_create_by!( managing_agent2 = Organisation.find_or_create_by!(
name: "Managing Agent 2", name: "Managing Agent 2",
@ -89,11 +89,23 @@ unless Rails.env.test?
provider_type: "LA", provider_type: "LA",
) )
standalone_no_stock = Organisation.find_or_create_by!(
name: "Standalone No Stock 1 Ltd",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: false,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
User.find_or_create_by!( User.find_or_create_by!(
name: "Provider Owns Stock", name: "Provider Owns Stock",
email: "provider.owner1@example.com", email: "provider.owner1@example.com",
organisation: standalone_owns_stock, organisation: standalone_owns_stock,
role: "data_provider", role: "data_provider",
is_dpo: true,
) do |user| ) do |user|
user.password = "password" user.password = "password"
user.confirmed_at = Time.zone.now user.confirmed_at = Time.zone.now
@ -105,31 +117,23 @@ unless Rails.env.test?
email: "coordinator.owner1@example.com", email: "coordinator.owner1@example.com",
organisation: standalone_owns_stock, organisation: standalone_owns_stock,
role: "data_coordinator", role: "data_coordinator",
is_dpo: true,
) do |user| ) do |user|
user.password = "password" user.password = "password"
user.confirmed_at = Time.zone.now user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user) create_data_protection_confirmation(user)
end end
standalone_no_stock = Organisation.find_or_create_by!(
name: "Standalone No Stock 1 Ltd",
address_line1: "2 Marsham Street",
address_line2: "London",
postcode: "SW1P 4DF",
holds_own_stock: false,
other_stock_owners: "None",
managing_agents_label: "None",
provider_type: "LA",
)
User.find_or_create_by!( User.find_or_create_by!(
name: "Provider No Stock", name: "Provider No Stock",
email: "provider.nostock@example.com", email: "provider.nostock@example.com",
organisation: standalone_no_stock, organisation: standalone_no_stock,
role: "data_provider", role: "data_provider",
is_dpo: true,
) do |user| ) do |user|
user.password = "password" user.password = "password"
user.confirmed_at = Time.zone.now user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end end
User.find_or_create_by!( User.find_or_create_by!(
@ -142,6 +146,54 @@ unless Rails.env.test?
user.confirmed_at = Time.zone.now user.confirmed_at = Time.zone.now
end end
User.find_or_create_by!(
name: "Stock owner 1",
email: "stock_owner1_dpo@example.com",
organisation: stock_owner1,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Stock owner 2",
email: "stock_owner2_dpo@example.com",
organisation: stock_owner2,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Managing agent 1",
email: "managing_agent1_dpo@example.com",
organisation: managing_agent1,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
User.find_or_create_by!(
name: "Managing agent 2",
email: "managing_agent2_dpo@example.com",
organisation: managing_agent2,
role: "data_coordinator",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
OrganisationRelationship.find_or_create_by!( OrganisationRelationship.find_or_create_by!(
parent_organisation: stock_owner1, parent_organisation: stock_owner1,
child_organisation: org, child_organisation: org,
@ -175,6 +227,7 @@ unless Rails.env.test?
email: "coordinator@example.com", email: "coordinator@example.com",
organisation: org, organisation: org,
role: "data_coordinator", role: "data_coordinator",
is_dpo: true,
) do |user| ) do |user|
user.password = "password" user.password = "password"
user.confirmed_at = Time.zone.now user.confirmed_at = Time.zone.now
@ -187,6 +240,7 @@ unless Rails.env.test?
email: "support@example.com", email: "support@example.com",
organisation: org, organisation: org,
role: "support", role: "support",
is_dpo: true,
) do |user| ) do |user|
user.password = "password" user.password = "password"
user.confirmed_at = Time.zone.now user.confirmed_at = Time.zone.now
@ -248,6 +302,18 @@ unless Rails.env.test?
) )
pp "Seeded dummy FooBar LTD organisation" pp "Seeded dummy FooBar LTD organisation"
User.find_or_create_by!(
name: "Dummy user",
email: "dummy_org@example.com",
organisation: dummy_org,
role: "data_provider",
is_dpo: true,
) do |user|
user.password = "password"
user.confirmed_at = Time.zone.now
create_data_protection_confirmation(user)
end
end end
if (Rails.env.development? || Rails.env.review?) && Scheme.count.zero? if (Rails.env.development? || Rails.env.review?) && Scheme.count.zero?

Loading…
Cancel
Save