mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 07:04:47 +02:00
17 lines
462 B
Ruby
17 lines
462 B
Ruby
class DomainDeleteJob < Que::Job
|
|
|
|
def run(domain_id)
|
|
domain = Domain.find(domain_id)
|
|
|
|
::PaperTrail.whodunnit = "job - #{self.class.name}"
|
|
WhoisRecord.where(domain_id: domain.id).destroy_all
|
|
|
|
domain.destroy
|
|
bye_bye = domain.versions.last
|
|
domain.registrar.notifications.create!(
|
|
text: "#{I18n.t(:domain_deleted)}: #{domain.name}",
|
|
attached_obj_id: bye_bye.id,
|
|
attached_obj_type: bye_bye.class.to_s
|
|
)
|
|
end
|
|
end
|