@@ -8,6 +8,7 @@ import util from '../../util';
88import { PERMISSION } from '../../permissions/constants' ;
99import { CONNECT_NOTIFICATION_EVENT , COPILOT_OPPORTUNITY_STATUS , TEMPLATE_IDS , USER_ROLE } from '../../constants' ;
1010import { createEvent } from '../../services/busApi' ;
11+ import { getCopilotTypeLabel } from '../../utils/copilot' ;
1112
1213const applyCopilotRequestValidations = {
1314 body : Joi . object ( ) . keys ( {
@@ -41,6 +42,12 @@ module.exports = [
4142 where : {
4243 id : copilotOpportunityId ,
4344 } ,
45+ include : [
46+ {
47+ model : models . CopilotRequest ,
48+ as : 'copilotRequest' ,
49+ } ,
50+ ] ,
4451 } ) . then ( async ( opportunity ) => {
4552 if ( ! opportunity ) {
4653 const err = new Error ( 'No opportunity found' ) ;
@@ -92,12 +99,15 @@ module.exports = [
9299
93100 const emailEventType = CONNECT_NOTIFICATION_EVENT . EXTERNAL_ACTION_EMAIL ;
94101 const copilotPortalUrl = config . get ( 'copilotPortalUrl' ) ;
102+ const requestData = opportunity . copilotRequest . data ;
95103 listOfSubjects . forEach ( ( subject ) => {
96104 createEvent ( emailEventType , {
97105 data : {
98106 user_name : subject . handle ,
99107 opportunity_details_url : `${ copilotPortalUrl } /opportunity/${ opportunity . id } #applications` ,
100108 work_manager_url : config . get ( 'workManagerUrl' ) ,
109+ opportunity_type : getCopilotTypeLabel ( requestData . projectType ) ,
110+ opportunity_title : requestData . opportunityTitle ,
101111 } ,
102112 sendgrid_template_id : TEMPLATE_IDS . APPLY_COPILOT ,
103113 recipients : [ subject . email ] ,
0 commit comments