mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
Merge remote-tracking branch 'origin/registry-663' into registry-660
This commit is contained in:
commit
a9f04f6f0e
7 changed files with 79 additions and 11 deletions
|
@ -19,24 +19,17 @@ authentication using electronic ID. Association through a business organisation
|
|||
=end
|
||||
|
||||
class BusinessRegistryCache < ActiveRecord::Base
|
||||
|
||||
# 1. load domains by business
|
||||
# 2. load domains by person
|
||||
def associated_contacts
|
||||
contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: 'EE').pluck(:id)
|
||||
contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
|
||||
contact_ids
|
||||
end
|
||||
|
||||
def associated_domain_ids
|
||||
contact_ids = Contact.where(ident_type: 'org', ident: associated_businesses, ident_country_code: ident_country_code).pluck(:id)
|
||||
contact_ids += Contact.where(ident_type: 'priv', ident: ident, ident_country_code: ident_country_code).pluck(:id)
|
||||
domain_ids = []
|
||||
|
||||
contact_ids = associated_contacts
|
||||
|
||||
unless contact_ids.blank?
|
||||
domain_ids = DomainContact.distinct.where(contact_id: contact_ids).pluck(:domain_id)
|
||||
end
|
||||
|
||||
domain_ids += Domain.where(registrant_id: contact_ids).pluck(:id)
|
||||
|
||||
domain_ids
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue