mirror of
https://github.com/internetee/registry.git
synced 2025-06-03 19:27:29 +02:00
Registrant API: Query representable and other contacts
This commit is contained in:
parent
4f9fa88bd4
commit
a67a0e5bf0
3 changed files with 5 additions and 5 deletions
|
@ -91,7 +91,7 @@ module Api
|
|||
private
|
||||
|
||||
def current_user_contacts
|
||||
current_registrant_user.contacts
|
||||
current_registrant_user.contacts(representable: false)
|
||||
rescue CompanyRegister::NotAvailableError
|
||||
current_registrant_user.direct_contacts
|
||||
end
|
||||
|
|
|
@ -210,11 +210,11 @@ class Contact < ApplicationRecord
|
|||
)
|
||||
end
|
||||
|
||||
def registrant_user_contacts(registrant_user, representment: true)
|
||||
def registrant_user_contacts(registrant_user, representable: true)
|
||||
represented_contacts = registrant_user_direct_contacts(registrant_user)
|
||||
.or(registrant_user_company_contacts(registrant_user))
|
||||
|
||||
return represented_contacts if representment
|
||||
return represented_contacts if representable
|
||||
|
||||
represented_contacts.or(registrant_user_indirect_contacts(registrant_user))
|
||||
end
|
||||
|
|
|
@ -22,8 +22,8 @@ class RegistrantUser < User
|
|||
citizen_country_code: country.alpha3)
|
||||
end
|
||||
|
||||
def contacts(representment: true)
|
||||
Contact.registrant_user_contacts(self, representment: representment)
|
||||
def contacts(representable: true)
|
||||
Contact.registrant_user_contacts(self, representable: representable)
|
||||
end
|
||||
|
||||
def direct_contacts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue