mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Get admin/registrant domains when company registry is down
This commit is contained in:
parent
1bb975c0cc
commit
419396f5b4
3 changed files with 16 additions and 4 deletions
|
@ -207,6 +207,14 @@ class Domain < ApplicationRecord
|
|||
)
|
||||
end
|
||||
|
||||
def registrant_user_direct_admin_registrant_domains(registrant_user)
|
||||
from(
|
||||
"(#{registrant_user_direct_domains_by_registrant(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_direct_domains_by_contact(registrant_user,
|
||||
except_tech: true).to_sql}) AS domains"
|
||||
)
|
||||
end
|
||||
|
||||
def registrant_user_domains(registrant_user)
|
||||
from(
|
||||
"(#{registrant_user_domains_by_registrant(registrant_user).to_sql} UNION " \
|
||||
|
@ -256,8 +264,10 @@ class Domain < ApplicationRecord
|
|||
where(registrant: registrant_user.direct_contacts)
|
||||
end
|
||||
|
||||
def registrant_user_direct_domains_by_contact(registrant_user)
|
||||
joins(:domain_contacts).where(domain_contacts: { contact_id: registrant_user.direct_contacts })
|
||||
def registrant_user_direct_domains_by_contact(registrant_user, except_tech: false)
|
||||
request = { contact_id: registrant_user.direct_contacts }
|
||||
request[:type] = [AdminDomainContact.name] if except_tech
|
||||
joins(:domain_contacts).where(domain_contacts: request)
|
||||
end
|
||||
|
||||
def registrant_user_company_registrant(companies)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue