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

@@ -63,6 +63,7 @@ services:
retries: 10
# LocalStack: Used to emulate AWS services locally, currently setup for SES
# Notes: Set the ENV Debug to 1 for additional logging
localstack:
image: localstack/localstack
container_name: localstack
@@ -74,10 +75,13 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- SERVICES=ses
- DEBUG=1
- DEBUG=0
- AWS_ACCESS_KEY_ID=test
- AWS_SECRET_ACCESS_KEY=test
- AWS_DEFAULT_REGION=ca-central-1
- EXTRA_CORS_ALLOWED_HEADERS=Authorization,Content-Type
- EXTRA_CORS_ALLOWED_ORIGINS=*
- EXTRA_CORS_EXPOSE_HEADERS=Authorization,Content-Type
ports:
- "4566:4566"
healthcheck:

35
nodemon.json Normal file
View File

@@ -0,0 +1,35 @@
{
"watch": [
"server.js",
"server"
],
"ignore": [
"client",
".circleci",
".platform",
".idea",
".vscode",
"_reference",
"firebase",
"hasura",
"logs",
"redis",
".dockerignore",
".ebignore",
".editorconfig",
".env.development",
".env.development.rome",
".eslintrc.json",
".gitignore",
".npmmrc",
".prettierrc.js",
"bodyshop_translations.babel",
"Dockerfile",
"ecosystem.config.js",
"job-totals-testing-util.js",
"nodemon.json",
"package.json",
"package-lock.json",
"setadmin.js"
]
}

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 })