From 5a908548617c56e5aca928d4151593eb95a14ed4 Mon Sep 17 00:00:00 2001 From: Dave Richer Date: Thu, 10 Oct 2024 13:01:36 -0400 Subject: [PATCH 1/3] feature/IO-2979-DST-Handling - Checkpoint Signed-off-by: Dave Richer --- docker-compose.yml | 6 +++++- nodemon.json | 35 ++++++++++++++++++++++++++++++++ server/email/mailer.js | 18 ---------------- server/email/tasksEmails.js | 23 +++++++++++++++++++++ server/email/tasksEmailsQueue.js | 2 +- 5 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 nodemon.json diff --git a/docker-compose.yml b/docker-compose.yml index 1bd0bc423..dd8dac175 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/nodemon.json b/nodemon.json new file mode 100644 index 000000000..e267a23c7 --- /dev/null +++ b/nodemon.json @@ -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" + ] +} diff --git a/server/email/mailer.js b/server/email/mailer.js index 78e02037e..6503e1f8c 100644 --- a/server/email/mailer.js +++ b/server/email/mailer.js @@ -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; diff --git a/server/email/tasksEmails.js b/server/email/tasksEmails.js index ea99a2d23..189471e5a 100644 --- a/server/email/tasksEmails.js +++ b/server/email/tasksEmails.js @@ -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, diff --git a/server/email/tasksEmailsQueue.js b/server/email/tasksEmailsQueue.js index dc004abc1..b01c9aa14 100644 --- a/server/email/tasksEmailsQueue.js +++ b/server/email/tasksEmailsQueue.js @@ -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 }) From 7fc6556866704b3bdd8e93ad23a40837d49aa246 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 11 Oct 2024 16:03:40 -0400 Subject: [PATCH 2/3] IO-2791 Stop gap change to limit exports to 10 records at a time. --- .../jobs-export-all-button/jobs-export-all-button.component.jsx | 2 +- .../payable-export-all-button.component.jsx | 2 +- .../payments-export-all-button.component.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx index 70f7763f2..d8e4da7ce 100644 --- a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx +++ b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx @@ -219,7 +219,7 @@ export function JobsExportAllButton({ }; return ( - ); diff --git a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx index 4194983bb..b6d39e915 100644 --- a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx +++ b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx @@ -200,7 +200,7 @@ export function PayableExportAll({ ); return ( - ); diff --git a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx index ba3334d14..23890abb7 100644 --- a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx +++ b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx @@ -180,7 +180,7 @@ export function PaymentsExportAllButton({ }; return ( - ); From 7879591bcf46b70687ca55768d7f36f8d2202f9f Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 11 Oct 2024 16:05:30 -0400 Subject: [PATCH 3/3] IO-2971 add null coalescing --- .../jobs-export-all-button/jobs-export-all-button.component.jsx | 2 +- .../payable-export-all-button.component.jsx | 2 +- .../payments-export-all-button.component.jsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx index d8e4da7ce..e149f39f0 100644 --- a/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx +++ b/client/src/components/jobs-export-all-button/jobs-export-all-button.component.jsx @@ -219,7 +219,7 @@ export function JobsExportAllButton({ }; return ( - ); diff --git a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx index b6d39e915..dc8316be8 100644 --- a/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx +++ b/client/src/components/payable-export-all-button/payable-export-all-button.component.jsx @@ -200,7 +200,7 @@ export function PayableExportAll({ ); return ( - ); diff --git a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx index 23890abb7..5c4246890 100644 --- a/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx +++ b/client/src/components/payments-export-all-button/payments-export-all-button.component.jsx @@ -180,7 +180,7 @@ export function PaymentsExportAllButton({ }; return ( - );