mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Story#108521790 - add tech contacts relation to domain history
This commit is contained in:
parent
8dfb62151d
commit
112dac9e7c
4 changed files with 13 additions and 2 deletions
|
@ -807,8 +807,8 @@ class Domain < ActiveRecord::Base
|
|||
log[:admin_contacts] = admin_contact_ids
|
||||
log[:tech_contacts] = tech_contact_ids
|
||||
log[:nameservers] = nameserver_ids
|
||||
log[:dnskeys] = dnskey_ids
|
||||
log[:registrant] = [registrant_id]
|
||||
log[:domain_statuses] = domain_status_ids
|
||||
log
|
||||
end
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ module Legacy
|
|||
belongs_to :history, foreign_key: :historyid
|
||||
has_one :object_history, foreign_key: :historyid, primary_key: :historyid
|
||||
has_many :domain_contact_map_histories, foreign_key: :historyid, primary_key: :historyid
|
||||
has_many :nsset_contact_map_histories, foreign_key: :historyid, primary_key: :historyid
|
||||
|
||||
def get_current_domain_object(time, change_param)
|
||||
x = self
|
||||
|
@ -39,6 +40,10 @@ module Legacy
|
|||
c_ids = domain_contact_map_histories.pluck(:contactid).join("','")
|
||||
DomainVersion.where("object->>'legacy_id' IN ('#{c_ids}')").uniq.pluck(:item_id)
|
||||
end
|
||||
def get_tech_contact_new_ids
|
||||
c_ids = nsset_contact_map_histories.pluck(:contactid).join("','")
|
||||
DomainVersion.where("object->>'legacy_id' IN ('#{c_ids}')").uniq.pluck(:item_id)
|
||||
end
|
||||
|
||||
def new_registrant_id
|
||||
@new_registrant_id ||= ::Contact.find_by(legacy_id: registrant).try(:id)
|
||||
|
|
5
app/models/legacy/nsset_contact_map_history.rb
Normal file
5
app/models/legacy/nsset_contact_map_history.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
module Legacy
|
||||
class NssetContactMapHistory < Db
|
||||
self.table_name = :nsset_contact_map_history
|
||||
end
|
||||
end
|
|
@ -131,8 +131,9 @@ namespace :import do
|
|||
created_at: time,
|
||||
children: {
|
||||
admin_contacts: [responder.get_admin_contact_new_ids],
|
||||
tech_contacts: [],
|
||||
tech_contacts: [responder.get_tech_contact_new_ids],
|
||||
nameservers: [],
|
||||
dnskeys: [],
|
||||
registrant: [responder.new_registrant_id]
|
||||
}
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue