ish_models 3.1.0.16 → 3.1.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9979bc99e29824d443826f24d71e64f31bc868419515883b43574b4a3754e6c9
4
- data.tar.gz: d467751ef81aaf1572fe8f510be942f2355b1d20b7964769145c319d912fdb94
3
+ metadata.gz: b697e15fa3600c6da649b862c536b7acfc36670075e5afc236982dbdd932b378
4
+ data.tar.gz: 92615b9c83accdc281029599e92cdd17aad4a6bc510663d4f590b25314daeeb5
5
5
  SHA512:
6
- metadata.gz: 3cf5af678f0b416eee707ecfe4b539523b6628b4bdd6566b089ea319a925cc3742c117f91a11539ad5661d2cfad22535e28e1424e58a5ea7471ed7da99d5e1fb
7
- data.tar.gz: df8e575d99195b7a8fff8d41ab7647fbddc1cadfef51dfa27885d5f95fcfb0e29c997ce074cce0e5d5daac9d59d26c95120b513f87489f93277b55a15ec994e9
6
+ metadata.gz: ca7d47294b41367f1c12828b325a76aa5ef4481f0ebbd4698834a9a622d48ff5dba420aafa57e4f5f7f6ace1de1712236c05ea1c78eba0a8ee46089c3dd980be
7
+ data.tar.gz: d4b87a0122efe2328406d064687f9620b1f3410daf4ce57ad0fe47eaab06297f5d40b57e6a1ea92b36c0ccb0af2fa02db082664a96f557c64e45681b650465d9
@@ -5,18 +5,18 @@ class Wco::Leadset
5
5
  store_in collection: 'wco_leadsets'
6
6
 
7
7
  field :company_url
8
- def domain; company_url; end
8
+ def domain; company_url; end ## @TODO: remove
9
9
  validates :company_url, presence: true, uniqueness: true
10
10
  index({ company_url: 1 }, { name: 'company_url' })
11
11
 
12
12
  field :email
13
13
  index({ email: 1 }, { name: 'email' })
14
- validates :email, presence: true, uniqueness: true
14
+ validates :email, presence: true # , uniqueness: true ## @TODO: should it be unique? _vp_ 2023-12-22
15
15
 
16
16
  has_many :profiles, class_name: 'Wco::Profile', inverse_of: :leadset
17
17
  has_many :appliances, class_name: 'WcoHosting::Appliance', inverse_of: :leadset
18
18
 
19
- has_many :serverhosts, class_name: 'WcoHosting::Serverhost', inverse_of: :leadset
19
+ has_and_belongs_to_many :serverhosts, class_name: 'WcoHosting::Serverhost' # , inverse_of: :leadset
20
20
  def next_serverhost
21
21
  serverhosts.first
22
22
  end
@@ -0,0 +1,9 @@
1
+
2
+
3
+ class Wco::Newsitem
4
+ include Mongoid::Document
5
+ include Mongoid::Timestamps
6
+ store_in collection: 'wco_newsitems'
7
+
8
+ belongs_to :profile, class_name: 'Wco::Profile', optional: true
9
+ end
@@ -12,6 +12,8 @@ class Wco::Profile
12
12
 
13
13
  belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :profile, optional: true
14
14
 
15
+ has_many :newsitems, class_name: 'Wco::Newsitem'
16
+
15
17
  def self.list
16
18
  all.map { |p| [ p.email, p.id ] }
17
19
  end
@@ -13,7 +13,7 @@ class WcoHosting::Serverhost
13
13
  field :name, type: :string
14
14
  validates :name, uniqueness: { scope: :leadset }, presence: true
15
15
 
16
- belongs_to :leadset, class_name: 'Wco::Leadset'
16
+ has_and_belongs_to_many :leadsets, class_name: 'Wco::Leadset'
17
17
 
18
18
  field :next_port, type: :integer, default: 8000
19
19
 
@@ -34,28 +34,28 @@ class WcoHosting::Serverhost
34
34
  add_docker_service( app )
35
35
  add_nginx_site( app )
36
36
  # load_database( app )
37
+ add_subdomain( app )
37
38
 
38
- ##
39
- ## DNS add_subdomain
40
- ##
41
- # ac = ActionController::Base.new
42
- # ac.instance_variable_set( :@app, app )
43
- # rendered_str = ac.render_to_string("wco_hosting/scripts/create_subdomain.json")
44
- # # puts '+++ add_subdomain rendered_str:'; print rendered_str
39
+ update({ next_port: app.serverhost.next_port + 1 })
40
+ end
45
41
 
46
- # file = Tempfile.new('prefix')
47
- # file.write rendered_str
48
- # file.close
42
+ def add_subdomain app
43
+ ac = ActionController::Base.new
44
+ ac.instance_variable_set( :@app, app )
45
+ rendered_str = ac.render_to_string("wco_hosting/scripts/create_subdomain.json")
46
+ # puts '+++ add_subdomain rendered_str:'; print rendered_str
49
47
 
50
- # cmd = "aws route53 change-resource-record-sets \
51
- # --hosted-zone-id <%= app.route53_zone %> \
52
- # --change-batch file://<%= file.path %> "
53
- # puts! cmd, 'cmd'
54
- # `#{cmd}`
48
+ file = Tempfile.new('prefix')
49
+ file.write rendered_str
50
+ file.close
55
51
 
56
- update({ next_port: app.serverhost.next_port + 1 })
52
+ cmd = "aws route53 change-resource-record-sets \
53
+ --hosted-zone-id <%= app.route53_zone %> \
54
+ --change-batch file://<%= file.path %> "
55
+ do_exec( cmd )
57
56
  end
58
57
 
58
+
59
59
  def add_nginx_site app
60
60
  ac = ActionController::Base.new
61
61
  ac.instance_variable_set( :@app, app )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.16
4
+ version: 3.1.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - mac_a2141
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-22 00:00:00.000000000 Z
11
+ date: 2023-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -139,6 +139,7 @@ files:
139
139
  - app/mailers/ish_models/application_mailer.rb
140
140
  - app/models/wco/lead.rb
141
141
  - app/models/wco/leadset.rb
142
+ - app/models/wco/newsitem.rb
142
143
  - app/models/wco/office_action.rb
143
144
  - app/models/wco/profile.rb
144
145
  - app/models/wco/tag.rb