mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
23 lines
632 B
Ruby
23 lines
632 B
Ruby
class TechDomainContact < DomainContact
|
|
# Audit log is needed, therefore no raw SQL
|
|
def self.replace(current_contact, new_contact)
|
|
affected_domains = []
|
|
skipped_domains = []
|
|
tech_contacts = where(contact: current_contact)
|
|
|
|
transaction do
|
|
tech_contacts.each do |tech_contact|
|
|
if tech_contact.domain.discarded?
|
|
skipped_domains << tech_contact.domain.name
|
|
next
|
|
end
|
|
|
|
tech_contact.contact = new_contact
|
|
tech_contact.save!
|
|
affected_domains << tech_contact.domain.name
|
|
end
|
|
end
|
|
|
|
return affected_domains.sort, skipped_domains.sort
|
|
end
|
|
end
|