mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 09:46:09 +02:00
added lift feature, fixed fd issues, changes mx to 2
This commit is contained in:
parent
5ea5dd7197
commit
8524503582
4 changed files with 52 additions and 6 deletions
|
@ -6,7 +6,7 @@
|
|||
# For email_validation event kind also check_level (regex/mx/smtp) is stored in the event_data
|
||||
class ValidationEvent < ApplicationRecord
|
||||
enum event_type: ValidationEvent::EventType::TYPES, _suffix: true
|
||||
VALIDATION_PERIOD = 45.minutes.freeze
|
||||
VALIDATION_PERIOD = 30.minutes.freeze
|
||||
VALID_CHECK_LEVELS = %w[regex mx smtp].freeze
|
||||
VALID_EVENTS_COUNT_THRESHOLD = 5
|
||||
|
||||
|
@ -26,7 +26,7 @@ class ValidationEvent < ApplicationRecord
|
|||
|
||||
belongs_to :validation_eventable, polymorphic: true
|
||||
|
||||
scope :recent, -> { where('created_at > ?', Time.zone.now - VALIDATION_PERIOD) }
|
||||
scope :recent, -> { where('created_at < ?', Time.zone.now - VALIDATION_PERIOD) }
|
||||
scope :successful, -> { where(success: true) }
|
||||
scope :failed, -> { where(success: false) }
|
||||
scope :regex, -> { where('event_data @> ?', { 'check_level': 'regex' }.to_json) }
|
||||
|
@ -69,5 +69,15 @@ class ValidationEvent < ApplicationRecord
|
|||
Domains::ForceDeleteEmail::Base.run(email: email)
|
||||
end
|
||||
|
||||
def lift_force_delete; end
|
||||
def lift_force_delete
|
||||
domain_contacts = Contact.where(email: email).map(&:domain_contacts).flatten
|
||||
registrant_ids = Registrant.where(email: email).pluck(:id)
|
||||
|
||||
domains = domain_contacts.map(&:domain).flatten +
|
||||
Domain.where(registrant_id: registrant_ids)
|
||||
|
||||
domains.each do |domain|
|
||||
Domains::ForceDeleteLift::Base.run(domain: domain)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue