diff --git a/app/representers/api/v1/user_representer.rb b/app/representers/api/v1/user_representer.rb index da149d808..a90f541fe 100644 --- a/app/representers/api/v1/user_representer.rb +++ b/app/representers/api/v1/user_representer.rb @@ -89,9 +89,9 @@ class UserRepresenter < Roar::Decorator writeable: false property :adopter_status, - if: ->(user_options:, **) { user_options.try(:fetch, :include_private_data, false) }, - type: String, - readable: true, + if: ->(user_options:, **) { user_options.try(:fetch, :include_private_data, false) }, + type: String, + readable: true, writeable: false property :salesforce_contact_id, @@ -193,6 +193,14 @@ class UserRepresenter < Roar::Decorator if: ->(user_options:, **) { user_options.try(:fetch, :include_private_data, false) }, getter: ->(represented:, **) { represented.external_ids.map(&:external_id) } + property :assignable_school_integrated, + if: ->(user_options:, **) { user_options.try(:fetch, :include_private_data, false) }, + getter: ->(*) { self.school.has_assignable_contacts unless self.school.nil?} + + property :assignable_user, + if: ->(user_options:, **) { user_options.try(:fetch, :include_private_data, false) }, + getter: ->(*) { self.external_ids.any? } + def to_hash(options = {}) # Avoid N+1 load on application_users.application ActiveRecord::Associations::Preloader.new.preload represented.application_users.to_a, :application