Class: OpportunityBriefing::UserContextBuilder

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

Overview

Builds the serializable actor context used for the generated briefing turn.
The initial turn gets no database tools: all evidence is supplied by the
bounded ContextBuilder snapshot.

Class Method Summary collapse

Class Method Details

.call(party:, account:) ⇒ Object



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

def self.call(party:, account:)
  {
    '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' => [],
    'opportunity_briefing_generation' => true
  }
end