mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
Add domain expiration procedure #2622
This commit is contained in:
parent
e2df9b7e19
commit
432e8a95ec
3 changed files with 26 additions and 0 deletions
|
@ -146,6 +146,12 @@ class Domain < ActiveRecord::Base
|
|||
{ admin_contacts: :registrar }
|
||||
)
|
||||
end
|
||||
|
||||
def expire_domains
|
||||
Domain.where('valid_to <= ?', Time.zone.now).each do |x|
|
||||
x.domain_statuses.create(value: DomainStatus::EXPIRED) if x.expirable?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def name=(value)
|
||||
|
@ -174,6 +180,11 @@ class Domain < ActiveRecord::Base
|
|||
)).empty?
|
||||
end
|
||||
|
||||
def expirable?
|
||||
return false if valid_to > Time.zone.now
|
||||
domain_statuses.where(value: DomainStatus::EXPIRED).empty?
|
||||
end
|
||||
|
||||
def pending_update?
|
||||
(domain_statuses.pluck(:value) & %W(
|
||||
#{DomainStatus::PENDING_UPDATE}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue