Add DNS keys to domain API response

It is fairly similar to what we do for WHOIS records, but one query is
slightly rewritten with removal of try-catch block
This commit is contained in:
Maciej Szlosarczyk 2020-06-18 10:42:39 +03:00
parent 41d0931607
commit 74a9d59753
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
2 changed files with 16 additions and 0 deletions

View file

@ -42,11 +42,23 @@ module Serializers
locked_by_registrant_at: domain.locked_by_registrant_at,
status_notes: domain.status_notes,
nameservers: nameservers,
dnssec_keys: dnssec_keys,
dnssec_changed_at: dnssec_updated_at
}
end
private
def dnssec_keys
domain.dnskeys.map do |key|
"#{key.flags} #{key.protocol} #{key.alg} #{key.public_key}"
end
end
def dnssec_updated_at
domain.dnskeys.order(updated_at: :desc).select(:updated_at).first
end
def contacts(type)
contact_pool = begin
if type == :tech