@@ -6,7 +6,7 @@ import config from 'config';
6
6
import models from '../../models' ;
7
7
import util from '../../util' ;
8
8
import { PERMISSION } from '../../permissions/constants' ;
9
- import { CONNECT_NOTIFICATION_EVENT , COPILOT_OPPORTUNITY_STATUS } from '../../constants' ;
9
+ import { CONNECT_NOTIFICATION_EVENT , COPILOT_OPPORTUNITY_STATUS , TEMPLATE_IDS , USER_ROLE } from '../../constants' ;
10
10
import { createEvent } from '../../services/busApi' ;
11
11
12
12
const applyCopilotRequestValidations = {
@@ -68,13 +68,13 @@ module.exports = [
68
68
69
69
return models . CopilotApplication . create ( data )
70
70
. then ( async ( result ) => {
71
- const pmRole = await util . getRolesByRoleName ( 'Project Manager' , req . log , req . id ) ;
71
+ const pmRole = await util . getRolesByRoleName ( USER_ROLE . PROJECT_MANAGER , req . log , req . id ) ;
72
72
const { subjects = [ ] } = await util . getRoleInfo ( pmRole [ 0 ] , req . log , req . id ) ;
73
73
74
74
const creator = await util . getMemberDetailsByUserIds ( [ opportunity . userId ] , req . log , req . id ) ;
75
75
const listOfSubjects = subjects ;
76
76
if ( creator ) {
77
- const isCreatorPartofSubjects = subjects . find ( item => item . email === creator [ 0 ] . email ) ;
77
+ const isCreatorPartofSubjects = subjects . find ( item => item . email . toLowerCase ( ) === creator [ 0 ] . email . toLowerCase ( ) ) ;
78
78
if ( ! isCreatorPartofSubjects ) {
79
79
listOfSubjects . push ( {
80
80
email : creator [ 0 ] . email ,
@@ -91,7 +91,7 @@ module.exports = [
91
91
user_name : subject . handle ,
92
92
opportunity_details_url : `${ copilotPortalUrl } /opportunity/${ opportunity . id } #applications` ,
93
93
} ,
94
- sendgrid_template_id : "d-d7c1f48628654798a05c8e09e52db14f" ,
94
+ sendgrid_template_id : TEMPLATE_IDS . APPLY_COPILOT ,
95
95
recipients : [ subject . email ] ,
96
96
version : 'v3' ,
97
97
} , req . log ) ;
0 commit comments