mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 05:56:20 +02:00
Create check force delete rake task
This commit is contained in:
parent
c246bbaa6d
commit
e159821a86
5 changed files with 93 additions and 47 deletions
12
lib/tasks/check_force_delete.rake
Normal file
12
lib/tasks/check_force_delete.rake
Normal file
|
@ -0,0 +1,12 @@
|
|||
desc 'Check Force Delete'
|
||||
task :check_force_delete do
|
||||
|
||||
invalid_contacts = Contact.joins(:validation_events).select do |contact|
|
||||
events = contact.validation_events
|
||||
events.mx.count >= 3 || events.regex.present?
|
||||
end.uniq(&:id)
|
||||
|
||||
invalid_contacts.each do |contact|
|
||||
ValidationEventCheckForceDeleteJob.perform_later(contact.id)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue