Email trigger issue solved for reject submission
This commit is contained in:
parent
d294dccb8c
commit
b48c422b63
@ -97,6 +97,7 @@ exports.createUser = async (req, res) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await sendEmailService(emailUsername, "establishment_user_creation_to_user", emailData);
|
await sendEmailService(emailUsername, "establishment_user_creation_to_user", emailData);
|
||||||
|
logger.info(`Establishment user creation email triggered for: ${sanitizeForLog(email)}`);
|
||||||
|
|
||||||
// Prepare secure response - only non-sensitive data
|
// Prepare secure response - only non-sensitive data
|
||||||
const responseUserName = user.name;
|
const responseUserName = user.name;
|
||||||
|
|||||||
@ -799,7 +799,7 @@ exports.approveOrRejectSubmission = async (req, res) => {
|
|||||||
const EstablishmentData = await Establishment.findOne({ where: { id :result['establishment_id'] } });
|
const EstablishmentData = await Establishment.findOne({ where: { id :result['establishment_id'] } });
|
||||||
const EstablishmentUserData = await EstablishmentUser.findAll({ where: { establishment_id :result['establishment_id'] , is_active : 1} });
|
const EstablishmentUserData = await EstablishmentUser.findAll({ where: { establishment_id :result['establishment_id'] , is_active : 1} });
|
||||||
|
|
||||||
if(approve_reject_status == 1)
|
if(approve_reject_status == 0 || approve_reject_status == 1)
|
||||||
{
|
{
|
||||||
for await (const userObj of EstablishmentUserData)
|
for await (const userObj of EstablishmentUserData)
|
||||||
{
|
{
|
||||||
@ -815,15 +815,12 @@ exports.approveOrRejectSubmission = async (req, res) => {
|
|||||||
support_phone : process.env.SUPPORT_PHONE,
|
support_phone : process.env.SUPPORT_PHONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
const template = approve_reject_status == 1
|
const template = approve_reject_status === 1
|
||||||
? "submission_approved_mail_to_establishment_user"
|
? "submission_approved_mail_to_establishment_user"
|
||||||
: "submission_rejected_mail_to_establishment_user";
|
: "submission_rejected_mail_to_establishment_user";
|
||||||
|
|
||||||
await sendEmailService(
|
await sendEmailService(sanitizeForLog(userObj.email), template, placeHolderData);
|
||||||
sanitizeForLog(userObj.email),
|
logger.info(`Submission approved or rejected status email triggered for: ${sanitizeForLog(userObj.email)}`);
|
||||||
template,
|
|
||||||
placeHolderData
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user