Class: DailyFocus::UserContextBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/services/daily_focus/user_context_builder.rb

Overview

Builds Assistant::ChatService user_context for the manager who owns the conversation.

Class Method Summary collapse

Class Method Details

.for_manager_party(party) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/services/daily_focus/user_context_builder.rb', line 6

def self.for_manager_party(party)
   = Account.find_by(party_id: party.id)
  {
    'full_name' => party.full_name,
    'party_id' => party.id,
    'department' => party.try(:employee_record)&.department,
    'job_title' => party.try(:job_title),
    'is_admin' => &.is_admin? || false,
    'is_manager' => &.is_manager? || false,
    'account_id' => &.id,
    'inherited_role_names' => &.inherited_role_names || [],
    'analytics_domains' =>  ? Assistant::DataDomainPolicy.domains_for(account: ) : [],
    'permitted_services' => DailyFocus::TOOL_SERVICE_KEYS
  }
end