mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Move interactor to namespace
This commit is contained in:
parent
4c7f9f2026
commit
30ddf83ee4
8 changed files with 40 additions and 34 deletions
|
@ -1,7 +0,0 @@
|
|||
module DomainDeleteInteraction
|
||||
class Base < ActiveInteraction::Base
|
||||
object :domain,
|
||||
class: Domain,
|
||||
description: 'Domain to delete'
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
module DomainDeleteInteraction
|
||||
class Delete < Base
|
||||
def execute
|
||||
::PaperTrail.request.whodunnit = "interaction - #{self.class.name}"
|
||||
WhoisRecord.where(domain_id: domain.id).destroy_all
|
||||
|
||||
domain.destroy
|
||||
compose(DomainDeleteInteraction::NotifyRegistrar, inputs)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
module DomainDeleteInteraction
|
||||
class NotifyRegistrar < Base
|
||||
def execute
|
||||
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
|
||||
end
|
9
app/interactions/domains/delete/base.rb
Normal file
9
app/interactions/domains/delete/base.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
module Domains
|
||||
module Delete
|
||||
class Base < ActiveInteraction::Base
|
||||
object :domain,
|
||||
class: Domain,
|
||||
description: 'Domain to delete'
|
||||
end
|
||||
end
|
||||
end
|
13
app/interactions/domains/delete/do_delete.rb
Normal file
13
app/interactions/domains/delete/do_delete.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module Domains
|
||||
module Delete
|
||||
class DoDelete < Base
|
||||
def execute
|
||||
::PaperTrail.request.whodunnit = "interaction - #{self.class.name}"
|
||||
WhoisRecord.where(domain_id: domain.id).destroy_all
|
||||
|
||||
domain.destroy
|
||||
compose(Domains::Delete::NotifyRegistrar, inputs)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
14
app/interactions/domains/delete/notify_registrar.rb
Normal file
14
app/interactions/domains/delete/notify_registrar.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
module Domains
|
||||
module Delete
|
||||
class NotifyRegistrar < Base
|
||||
def execute
|
||||
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
|
||||
end
|
||||
end
|
|
@ -3,6 +3,6 @@ class DomainDeleteJob < Que::Job
|
|||
def run(domain_id)
|
||||
domain = Domain.find(domain_id)
|
||||
|
||||
DomainDeleteInteraction::Delete.run(domain: domain)
|
||||
Domains::Delete::DoDelete.run(domain: domain)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue