mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
Mode all the actions to Interactions folder
This commit is contained in:
parent
d7f01f24a2
commit
fdef27c45e
18 changed files with 20 additions and 20 deletions
33
app/interactions/actions/contact_delete.rb
Normal file
33
app/interactions/actions/contact_delete.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
module Actions
|
||||
class ContactDelete
|
||||
attr_reader :contact
|
||||
attr_reader :new_attributes
|
||||
attr_reader :legal_document
|
||||
attr_reader :ident
|
||||
attr_reader :user
|
||||
|
||||
def initialize(contact, legal_document = nil)
|
||||
@legal_document = legal_document
|
||||
@contact = contact
|
||||
end
|
||||
|
||||
def call
|
||||
maybe_attach_legal_doc
|
||||
|
||||
if contact.linked?
|
||||
contact.errors.add(:domains, :exist)
|
||||
return
|
||||
end
|
||||
|
||||
commit
|
||||
end
|
||||
|
||||
def maybe_attach_legal_doc
|
||||
::Actions::BaseAction.maybe_attach_legal_doc(contact, legal_document)
|
||||
end
|
||||
|
||||
def commit
|
||||
contact.destroy
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue