Image email template issue fixed

This commit is contained in:
unknown 2026-01-20 20:49:26 +05:30
parent 2569eeeef8
commit a0218463c0
4 changed files with 21 additions and 7 deletions

View File

@ -36,6 +36,7 @@ exports.testEmail = async (req, res) => {
password: '<pwd>',
support_email : process.env.SUPPORT_EMAIL,
support_phone : process.env.SUPPORT_PHONE,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
}
await sendEmailService('gowthamceline46@gmail.com', 'establishment_user_creation_to_user', placeHolderData);
@ -268,6 +269,7 @@ exports.createEstablishment = async (req, res) => {
password: plainPasswordForEmail,
support_email: emailSupportEmail,
support_phone: emailSupportPhone,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
};
// Send email notification to user
@ -1306,7 +1308,7 @@ exports.requestOTPForLogin = async (req, res) => {
exports.verifyOTPForLogin = async (req, res) => {
try {
let { registered_email, otp } = req.body;
const envDb = process.env.DB_NAME?.toLowerCase();
const isBypassEnv = envDb === "ipidev" || envDb === "ipiuat";
@ -1935,7 +1937,8 @@ exports.establishmentBulkUpload = async (req, res) => {
username: p.email,
password: autoPassword,
support_email: process.env.SUPPORT_EMAIL,
support_phone: process.env.SUPPORT_PHONE
support_phone: process.env.SUPPORT_PHONE,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
};
await sendEmailService(p.email, "establishment_user_creation_to_user", placeHolderData);

View File

@ -103,7 +103,8 @@ exports.createUser = async (req, res) => {
username: emailUsername,
password: plainPasswordForEmail,
support_email: emailSupportEmail,
support_phone: emailSupportPhone
support_phone: emailSupportPhone,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
};
await sendEmailService(emailUsername, "establishment_user_creation_to_user", emailData);
@ -336,6 +337,7 @@ exports.triggerEstablishmentUsersWelcomeEmail = async (req, res) => {
password: password,
support_email: process.env.SUPPORT_EMAIL,
support_phone: process.env.SUPPORT_PHONE,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
}
);
}

View File

@ -59,7 +59,8 @@ exports.createConfig = async (req, res) => {
closes_on: end_date,
portal_url: process.env.FE_BASE_URL,
support_email: process.env.SUPPORT_EMAIL,
support_phone: process.env.SUPPORT_PHONE
support_phone: process.env.SUPPORT_PHONE,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
};
const data = await QuarterlyWindowsConfiguration.create(payload);

View File

@ -186,6 +186,7 @@ exports.createSubmission = async (req, res) => {
// support_email : process.env.SUPPORT_EMAIL,
// support_phone : process.env.SUPPORT_PHONE,
// portal_url : process.env.FE_BASE_URL,
// logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`
// }
// await sendEmailService(userObj.email, 'submission_created_mail_to_admin', placeHolderData);
@ -219,6 +220,8 @@ exports.createSubmission = async (req, res) => {
return `${datePart}, ${upperTime} GST (UAE)`;
};
const surveyData = await QuarterlyWindowsConfiguration.findOne({ where: { year :result['year'] , quarter : result['quarter'] } });
// Shared placeholder data
const basePlaceholder = {
quarter: result.quarter,
@ -228,7 +231,9 @@ exports.createSubmission = async (req, res) => {
submission_date: formatSubmissionDate(result.created_at),
support_email: process.env.SUPPORT_EMAIL,
support_phone: process.env.SUPPORT_PHONE,
portal_url: process.env.FE_BASE_URL
portal_url: process.env.FE_BASE_URL,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`,
survey_name: surveyData.survey_name
};
// --- SEND EMAILS TO ESTABLISHMENT USERS ---
@ -809,7 +814,7 @@ exports.approveOrRejectSubmission = async (req, res) => {
updated_at: new Date()
});
const QuarterlyWindowsConfiguration = db.QuarterlyWindowsConfiguration;
//send email to establishment user
const EstablishmentData = await Establishment.findOne({ where: { id :result['establishment_id'] } });
const EstablishmentUserData = await EstablishmentUser.findAll({ where: { establishment_id :result['establishment_id'] , is_active : 1} });
@ -818,7 +823,6 @@ exports.approveOrRejectSubmission = async (req, res) => {
{
for await (const userObj of EstablishmentUserData)
{
const formatSubmissionDate = (date) => {
const formatted = new Intl.DateTimeFormat("en-GB", {
day: "2-digit",
@ -834,6 +838,8 @@ exports.approveOrRejectSubmission = async (req, res) => {
return `${datePart}, ${upperTime} GST (UAE)`;
};
const surveyData = await QuarterlyWindowsConfiguration.findOne({ where: { year :result['year'] , quarter : result['quarter'] } });
placeHolderData = {
user_name: sanitizeForLog(userObj.name),
portal_url : process.env.FE_BASE_URL,
@ -844,6 +850,8 @@ exports.approveOrRejectSubmission = async (req, res) => {
rejection_reason : result['reject_reason'],
support_email : process.env.SUPPORT_EMAIL,
support_phone : process.env.SUPPORT_PHONE,
logo_url: `${process.env.APP_BASE_URL}/assets/FCSCLogo.png`,
survey_name: surveyData.survey_name
};
const template = approve_reject_status === 1