summaryrefslogtreecommitdiff
path: root/bin/sample.rb
blob: 5297ff43d864b3c7888df51e91c90896d41c6c40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env ruby
require ::File.expand_path('../../config/environment',  __FILE__)

ActiveRecord::Base.transaction do
  abc_resources = Company.create(id: '680fc2c1-9557-49fd-b05f-0f700a67ca0c', name: 'ABC Resources Ltd.')
  xyz_resources = Company.create(id: '04e6b076-41ca-4849-8a94-14e4e505ffe8', name: 'XYZ Resources Ltd.')

  jd = User.create(first_name: 'john', last_name: 'dielwart', company: abc_resources)
  hal = User.create(first_name: 'hal', last_name: 'kvisle', company: xyz_resources)

  township_1 = Location.create(latitude: 51.06, longitude: -114.09, township: '1')
  township_2 = Location.create(latitude: 40.06, longitude: -100.09, township: '2')
  township_3 = Location.create(latitude: 30.06, longitude: -90.01, township: '3')

  public_license = abc_resources.licenses.create(
    id: 'e4650fd2-2298-463a-bfcd-fb953d996d6e',
    well_type: WellType::NFW,
    location: township_1,
    applicant: jd,
    issued_at: 1.day.ago,
    expired_at: 1.year.from_now
  )

  public_expired_license = abc_resources.licenses.create(
    id: '20d69330-ebc9-40b6-9d25-0174aea3c056',
    well_type: WellType::DPT,
    location: township_3,
    applicant: jd,
    issued_at: 1.year.ago,
    expired_at: 1.day.ago
  )

  confidential_license = xyz_resources.licenses.create(
    id: 'fd3918dd-6296-49ce-83bb-c518916fb82e',
    well_type: WellType::SPT,
    location: township_2,
    applicant: hal,
    issued_at: 1.day.ago,
    expired_at: 1.year.from_now
  )
end