mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 17:01:44 +02:00
parent
640faaadb9
commit
42e8f86dae
51 changed files with 1619 additions and 53 deletions
|
@ -1,21 +1,6 @@
|
|||
module Concerns::Domain::Discardable
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
class_methods do
|
||||
def discard_domains
|
||||
domains = where('delete_at < ? AND ? != ALL(coalesce(statuses, array[]::varchar[])) AND' \
|
||||
' ? != ALL(COALESCE(statuses, array[]::varchar[]))',
|
||||
Time.zone.now,
|
||||
DomainStatus::SERVER_DELETE_PROHIBITED,
|
||||
DomainStatus::DELETE_CANDIDATE)
|
||||
|
||||
domains.each do |domain|
|
||||
domain.discard
|
||||
yield domain if block_given?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def discard
|
||||
raise 'Domain is already discarded' if discarded?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue