diff --git a/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts b/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts index 33350e1..5ab331a 100644 --- a/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts +++ b/src/modules/host/handlers/Activity_Hub/OnBoarding/submitPQAnswer.ts @@ -8,6 +8,7 @@ import { safeHandler } from '../../../../../common/utils/handlers/safeHandler'; import ApiError from '../../../../../common/utils/helper/ApiError'; import { HostService } from '../../../services/host.service'; import { prismaClient } from '../../../../../common/database/prisma.lambda.service'; +import { sendPQPEmailToAM } from '@/modules/host/services/sendHostResubmitEmailToAM.service'; const hostService = new HostService(prismaClient); @@ -272,6 +273,15 @@ export const handler = safeHandler(async (event: APIGatewayProxyEvent): Promise< const allPQPQuestionAnswerResponse = await hostService.getAllPQUpdatedResponse(activityXid) + const details = await hostService.getSuggestionDetails(user.id); + + await sendPQPEmailToAM( + details.hostDetails.accountManager.emailAddress, + details.hostDetails.accountManager.firstName, + details.hostDetails.companyName, + details.hostDetails.user.userRefNumber, + ) + // 11) Compose response const responseMessage = existingHeader ? "PQQ answer updated successfully" : "PQQ answer submitted successfully"; diff --git a/src/modules/host/services/sendHostResubmitEmailToAM.service.ts b/src/modules/host/services/sendHostResubmitEmailToAM.service.ts index 87c1bd9..41a3359 100644 --- a/src/modules/host/services/sendHostResubmitEmailToAM.service.ts +++ b/src/modules/host/services/sendHostResubmitEmailToAM.service.ts @@ -76,3 +76,41 @@ export async function sendEmailToMinglarAdmin( throw new ApiError(500, "Failed to send OTP to host via email."); } } + +export async function sendPQPEmailToAM( + emailAddress: string, + minglarAdminName: string, + hostCompanyName: string, + hostRefNumber: string +): Promise<{ + sent: boolean; + // messageId: string +}> { + + const subject = `New Pre-qualification Questionnaire from : ${hostCompanyName}`; + + const htmlContent = ` +
Dear ${minglarAdminName},
+Host ${hostCompanyName} with reference number: ${hostRefNumber} has submited their pre-qualification questionnaire.
+Please review their appliaction and take the necessary action.
+Best regards,
Minglar Team