mirror of
https://github.com/internetee/registry.git
synced 2025-05-23 04:39:38 +02:00
Merge branch 'registry-460' into registry-475
This commit is contained in:
commit
0fd08b9d0a
1 changed files with 39 additions and 108 deletions
131
db/seeds.rb
131
db/seeds.rb
|
@ -1,116 +1,47 @@
|
||||||
# This file should contain all the record creation needed to seed the database with its default values.
|
# This file should contain all the record creation needed to seed the database with its default values.
|
||||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
||||||
|
|
||||||
registrar1 = Registrar.where(
|
ActiveRecord::Base.transaction do
|
||||||
name: 'Registrar First AS',
|
registrar = Registrar.create!(
|
||||||
reg_no: '10300220',
|
name: 'Test',
|
||||||
street: 'Pärnu mnt 2',
|
reg_no: '1234',
|
||||||
city: 'Tallinn',
|
street: 'test',
|
||||||
state: 'Harju maakond',
|
city: 'test',
|
||||||
zip: '11415',
|
state: 'test',
|
||||||
email: 'registrar1@example.com',
|
zip: '1234',
|
||||||
country_code: 'EE',
|
email: 'test@domain.tld',
|
||||||
code: 'REG1'
|
country_code: 'US',
|
||||||
).first_or_create!
|
code: 'US1'
|
||||||
|
)
|
||||||
|
|
||||||
@api_user1 = ApiUser.where(
|
registrar.accounts.create!(account_type: Account::CASH, currency: 'EUR')
|
||||||
username: 'registrar1',
|
|
||||||
).first_or_create!(
|
ApiUser.create!(
|
||||||
password: 'password',
|
username: 'test',
|
||||||
|
password: 'testtest',
|
||||||
identity_code: '51001091072',
|
identity_code: '51001091072',
|
||||||
active: true,
|
active: true,
|
||||||
registrar: registrar1,
|
registrar: registrar,
|
||||||
roles: ['super']
|
roles: ['super']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
AdminUser.create!(
|
||||||
registrar2 = Registrar.where(
|
username: 'test',
|
||||||
name: 'Registrar Second AS',
|
email: 'test@domain.tld',
|
||||||
reg_no: '10529229',
|
password: 'testtest',
|
||||||
street: 'Vabaduse pst 32',
|
password_confirmation: 'testtest',
|
||||||
city: 'Tallinn',
|
country_code: 'US',
|
||||||
state: 'Harju maakond',
|
roles: ['admin']
|
||||||
zip: '11315',
|
|
||||||
email: 'registrar2@example.com',
|
|
||||||
country_code: 'EE',
|
|
||||||
code: 'REG2'
|
|
||||||
).first_or_create!
|
|
||||||
|
|
||||||
@api_user2 = ApiUser.where(
|
|
||||||
username: 'registrar2',
|
|
||||||
).first_or_create!(
|
|
||||||
password: 'password',
|
|
||||||
identity_code: '11412090004',
|
|
||||||
active: true,
|
|
||||||
registrar: registrar2,
|
|
||||||
roles: ['super']
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ZonefileSetting.create!(
|
||||||
Registrar.all.each do |x|
|
origin: 'tld',
|
||||||
x.accounts.where(account_type: Account::CASH, currency: 'EUR').first_or_create!
|
|
||||||
end
|
|
||||||
|
|
||||||
admin1 = {
|
|
||||||
username: 'user1',
|
|
||||||
email: 'user1@example.ee',
|
|
||||||
identity_code: '37810013855',
|
|
||||||
country_code: 'EE'
|
|
||||||
}
|
|
||||||
admin2 = {
|
|
||||||
username: 'user2',
|
|
||||||
email: 'user2@example.ee',
|
|
||||||
identity_code: '37810010085',
|
|
||||||
country_code: 'EE'
|
|
||||||
}
|
|
||||||
admin3 = {
|
|
||||||
username: 'user3',
|
|
||||||
email: 'user3@example.ee',
|
|
||||||
identity_code: '37810010727',
|
|
||||||
country_code: 'EE'
|
|
||||||
}
|
|
||||||
|
|
||||||
[admin1, admin2, admin3].each do |at|
|
|
||||||
admin = AdminUser.where(at)
|
|
||||||
next if admin.present?
|
|
||||||
admin = AdminUser.new(at.merge({ password_confirmation: 'testtest', password: 'testtest' }))
|
|
||||||
admin.roles = ['admin']
|
|
||||||
admin.save
|
|
||||||
end
|
|
||||||
|
|
||||||
ZonefileSetting.where({
|
|
||||||
origin: 'ee',
|
|
||||||
ttl: 43200,
|
ttl: 43200,
|
||||||
refresh: 3600,
|
refresh: 3600,
|
||||||
retry: 900,
|
retry: 900,
|
||||||
expire: 1209600,
|
expire: 1209600,
|
||||||
minimum_ttl: 3600,
|
minimum_ttl: 3600,
|
||||||
email: 'hostmaster.eestiinternet.ee',
|
email: 'admin.domain.tld',
|
||||||
master_nameserver: 'ns.tld.ee'
|
master_nameserver: 'ns.tld'
|
||||||
}).first_or_create!
|
)
|
||||||
|
end
|
||||||
ZonefileSetting.where({
|
|
||||||
origin: 'pri.ee',
|
|
||||||
ttl: 43200,
|
|
||||||
refresh: 3600,
|
|
||||||
retry: 900,
|
|
||||||
expire: 1209600,
|
|
||||||
minimum_ttl: 3600,
|
|
||||||
email: 'hostmaster.eestiinternet.ee',
|
|
||||||
master_nameserver: 'ns.tld.ee'
|
|
||||||
}).first_or_create!
|
|
||||||
|
|
||||||
# Registrar.where(
|
|
||||||
# name: 'EIS',
|
|
||||||
# reg_no: '90010019',
|
|
||||||
# phone: '+3727271000',
|
|
||||||
# country_code: 'EE',
|
|
||||||
# vat_no: 'EE101286464',
|
|
||||||
# email: 'info@internet.ee',
|
|
||||||
# state: 'Harjumaa',
|
|
||||||
# city: 'Tallinn',
|
|
||||||
# street: 'Paldiski mnt 80',
|
|
||||||
# zip: '10617',
|
|
||||||
# url: 'www.internet.ee',
|
|
||||||
# code: 'EIS'
|
|
||||||
# ).first_or_create!
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue