mirror of
https://github.com/internetee/registry.git
synced 2025-06-10 22:54:47 +02:00
Registrant API: Optimize contact link(s) query
This commit is contained in:
parent
807561f3e5
commit
70a5d9f27a
1 changed files with 3 additions and 2 deletions
|
@ -361,8 +361,9 @@ class Contact < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def related_domains
|
def related_domains
|
||||||
a = related_domain_descriptions
|
dom_id = DomainContact.select(:domain_id).where(contact_id: id).map(&:domain_id).uniq
|
||||||
a.keys.map { |d| { name: d, id: a[d][:id], roles: a[d][:roles] } }
|
res = Domain.where(id: dom_id).or(Domain.where(registrant_id: id)).select(:name, :uuid)
|
||||||
|
res.pluck(:name, :uuid).map { |name, id| { name: name, id: id } }
|
||||||
end
|
end
|
||||||
|
|
||||||
def status_notes_array=(notes)
|
def status_notes_array=(notes)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue