mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Exclude tech from default domain query
This commit is contained in:
parent
d07b6a9c7b
commit
1bb975c0cc
3 changed files with 17 additions and 4 deletions
|
@ -198,6 +198,15 @@ class Domain < ApplicationRecord
|
|||
Setting.nameserver_required
|
||||
end
|
||||
|
||||
def registrant_user_admin_registrant_domains(registrant_user)
|
||||
companies = Contact.registrant_user_company_contacts(registrant_user)
|
||||
from(
|
||||
"(#{registrant_user_administered_domains(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_company_registrant(registrant_user).to_sql} UNION " \
|
||||
"#{registrant_user_domains_company(companies, 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 " \
|
||||
|
@ -255,8 +264,10 @@ class Domain < ApplicationRecord
|
|||
where(registrant: companies)
|
||||
end
|
||||
|
||||
def registrant_user_domains_company(companies)
|
||||
joins(:domain_contacts).where(domain_contacts: { contact: companies })
|
||||
def registrant_user_domains_company(companies, except_tech: false)
|
||||
request = { contact: companies }
|
||||
request[:type] = [AdminDomainContact.name] if except_tech
|
||||
joins(:domain_contacts).where(domain_contacts: request)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue