Skip to content

Commit 740d0c5

Browse files
updated seeds mock
1 parent 70b978c commit 740d0c5

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

db/seeds_mock.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,38 @@ def generate_random_string(length = 8)
196196
end
197197
end
198198
end
199+
200+
# Custom User requested by the user
201+
puts "Processing Custom Registrar: REG1..."
202+
custom_registrar = Registrar.find_or_create_by!(code: "REG1") do |r|
203+
r.name = "Registrar First AS"
204+
r.reg_no = "10300220"
205+
r.email = "registrar1@example.com"
206+
r.phone = "+37200000766"
207+
r.address_street = "Staging St 1"
208+
r.address_city = "Tallinn"
209+
r.address_zip = "10111"
210+
r.address_country_code = "EE"
211+
r.accounting_customer_code = "REG1"
212+
r.language = "en"
213+
r.reference_no = Billing::ReferenceNo.generate(owner: r) rescue "1234567"
214+
end
215+
custom_registrar.accounts.find_or_create_by!(account_type: Account::CASH, currency: 'EUR')
216+
217+
api_user = ApiUser.find_or_create_by!(username: "Märi Änn R1") do |u|
218+
u.plain_text_password = "password"
219+
u.registrar = custom_registrar
220+
u.roles = ["super"] # From staging: roles=["super"]
221+
u.active = true
222+
u.identity_code = "60001019906"
223+
end
224+
225+
# Allow the requested IP for this user
226+
custom_registrar.white_ips.find_or_create_by!(
227+
ipv4: '85.253.229.124',
228+
interfaces: ['api', 'registrar']
229+
)
230+
puts " Custom Staging User & Registrar ensured!"
199231
end
200232

201233
puts "Mock Data Generation Completed!"

0 commit comments

Comments
 (0)