feature/IO-2979-DST-Handling

- Checkpoint

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-10-10 13:01:36 -04:00
parent 2bf074d85a
commit 5a90854861
5 changed files with 64 additions and 20 deletions

View File

@@ -28,22 +28,4 @@ let transporter = nodemailer.createTransport({
SES: { ses, aws }
});
if (isLocal) {
// Wrap the sendMail function to log the email contents to the console in local environment
const originalSendMail = transporter.sendMail.bind(transporter);
transporter.sendMail = async (mailOptions) => {
try {
const result = await originalSendMail(mailOptions);
console.log(
`Email sent successfully - From: ${result?.envelope?.from} - To: ${result?.envelope?.to} - MessageID ${result.messageId} - Check LocalStack to see message`
);
return result;
} catch (error) {
console.error("Failed to send email:", error);
throw error;
}
};
}
module.exports = transporter;

View File

@@ -324,6 +324,29 @@ const tasksRemindEmail = async (req, res) => {
}
};
// Note: Uncomment this to test locally, it will call the remind_at email check every 20 seconds
// const callTaskRemindEmailInternally = () => {
// const req = {
// body: {
// // You can mock any request data here if needed
// }
// };
//
// const res = {
// status: (code) => {
// return {
// json: (data) => {
// console.log(`Response Status: ${code}`, data);
// }
// };
// }
// };
//
// // Call the taskRemindEmail function with mock req and res
// tasksRemindEmail(req, res);
// };
// setInterval(callTaskRemindEmailInternally, 20000);
module.exports = {
taskAssignedEmail,
tasksRemindEmail,

View File

@@ -13,7 +13,7 @@ const taskEmailQueue = () =>
console.log("Processing reminds for taskIds: ", taskIds.join(", "));
// Set the remind_at_sent to the current time.
const now = moment().toISOString();
const now = moment.utc().toISOString();
client
.request(UPDATE_TASKS_REMIND_AT_SENT, { taskIds, now })