Merged in release/2025-02-28 (pull request #2124)
release/2025-02-28 Approved-by: Patrick Fic
This commit is contained in:
@@ -92,7 +92,7 @@ const sendTaskEmail = async ({ to, subject, type = "text", html, text, attachmen
|
|||||||
},
|
},
|
||||||
(err, info) => {
|
(err, info) => {
|
||||||
// (message, type, user, record, meta
|
// (message, type, user, record, meta
|
||||||
logger.log("server-email", err ? "error" : "debug", null, null, { message: err || info });
|
logger.log("server-email", err ? "error" : "debug", null, null, { message: err ? err?.message : info });
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -239,24 +239,24 @@ const emailBounce = async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//If it's bounced, log it as bounced in audit log. Send an email to the user.
|
//If it's bounced, log it as bounced in audit log. Send an email to the user.
|
||||||
const result = await client.request(queries.UPDATE_EMAIL_AUDIT, {
|
await client.request(queries.UPDATE_EMAIL_AUDIT, {
|
||||||
sesid: messageId,
|
sesid: messageId,
|
||||||
status: "Bounced",
|
status: "Bounced",
|
||||||
context: message.bounce?.bouncedRecipients
|
context: message.bounce?.bouncedRecipients
|
||||||
});
|
});
|
||||||
mailer.sendMail(
|
mailer.sendMail(
|
||||||
{
|
{
|
||||||
from: InstanceMgr({
|
from: InstanceManager({
|
||||||
imex: `ImEX Online <noreply@imex.online>`,
|
imex: `ImEX Online <noreply@imex.online>`,
|
||||||
rome: `Rome Online <noreply@romeonline.io>`
|
rome: `Rome Online <noreply@romeonline.io>`
|
||||||
}),
|
}),
|
||||||
to: replyTo,
|
to: replyTo,
|
||||||
//bcc: "patrick@snapt.ca",
|
//bcc: "patrick@snapt.ca",
|
||||||
subject: `${InstanceMgr({
|
subject: `${InstanceManager({
|
||||||
imex: "ImEX Online",
|
imex: "ImEX Online",
|
||||||
rome: "Rome Online"
|
rome: "Rome Online"
|
||||||
})} Bounced Email - RE: ${subject}`,
|
})} Bounced Email - RE: ${subject}`,
|
||||||
text: `${InstanceMgr({
|
text: `${InstanceManager({
|
||||||
imex: "ImEX Online",
|
imex: "ImEX Online",
|
||||||
rome: "Rome Online"
|
rome: "Rome Online"
|
||||||
})} has tried to deliver an email with the subject: ${subject} to the intended recipients but encountered an error.
|
})} has tried to deliver an email with the subject: ${subject} to the intended recipients but encountered an error.
|
||||||
@@ -270,7 +270,7 @@ ${body.bounce?.bouncedRecipients.map(
|
|||||||
},
|
},
|
||||||
(err, info) => {
|
(err, info) => {
|
||||||
logger.log("sns-error", err ? "error" : "debug", "api", null, {
|
logger.log("sns-error", err ? "error" : "debug", "api", null, {
|
||||||
message: err ? JSON.stringify(error) : info
|
message: err ? err?.message : info
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
|
|
||||||
switch (req.body.table.name) {
|
switch (req.body.table.name) {
|
||||||
case "jobs":
|
case "jobs":
|
||||||
|
logger.log("os-handler-jobs", "DEBUG", req.user.email, null, {
|
||||||
|
jobid: req.body.event.data.new.id,
|
||||||
|
bodyshopid: req.body.event.data.new.shopid
|
||||||
|
});
|
||||||
document = pick(req.body.event.data.new, [
|
document = pick(req.body.event.data.new, [
|
||||||
"id",
|
"id",
|
||||||
"bodyshopid",
|
"bodyshopid",
|
||||||
@@ -49,6 +53,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
document.bodyshopid = req.body.event.data.new.shopid;
|
document.bodyshopid = req.body.event.data.new.shopid;
|
||||||
break;
|
break;
|
||||||
case "vehicles":
|
case "vehicles":
|
||||||
|
logger.log("os-handler-vehicles", "DEBUG", req.user.email, null, {
|
||||||
|
vehicleid: req.body.event.data.new.id,
|
||||||
|
bodyshopid: req.body.event.data.new.shopid
|
||||||
|
});
|
||||||
document = pick(req.body.event.data.new, [
|
document = pick(req.body.event.data.new, [
|
||||||
"id",
|
"id",
|
||||||
"v_model_yr",
|
"v_model_yr",
|
||||||
@@ -61,6 +69,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
document.bodyshopid = req.body.event.data.new.shopid;
|
document.bodyshopid = req.body.event.data.new.shopid;
|
||||||
break;
|
break;
|
||||||
case "owners":
|
case "owners":
|
||||||
|
logger.log("os-handler-owners", "DEBUG", req.user.email, null, {
|
||||||
|
ownerid: req.body.event.data.new.id,
|
||||||
|
bodyshopid: req.body.event.data.new.shopid
|
||||||
|
});
|
||||||
document = pick(req.body.event.data.new, ["id", "ownr_fn", "ownr_ln", "ownr_co_nm", "ownr_ph1", "ownr_ph2"]);
|
document = pick(req.body.event.data.new, ["id", "ownr_fn", "ownr_ln", "ownr_co_nm", "ownr_ph1", "ownr_ph2"]);
|
||||||
document.bodyshopid = req.body.event.data.new.shopid;
|
document.bodyshopid = req.body.event.data.new.shopid;
|
||||||
break;
|
break;
|
||||||
@@ -96,9 +108,15 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
...bill.bills_by_pk,
|
...bill.bills_by_pk,
|
||||||
bodyshopid: bill.bills_by_pk.job.shopid
|
bodyshopid: bill.bills_by_pk.job.shopid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
logger.log("os-handler-bills", "DEBUG", req.user.email, null, {
|
||||||
|
billid: req.body.event.data.new.id,
|
||||||
|
bodyshopid: bill.bills_by_pk.job.shopid
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case "payments":
|
case "payments":
|
||||||
//Query to get the job and RO number
|
//Query to get the job and RO number
|
||||||
|
|
||||||
const payment = await client.request(
|
const payment = await client.request(
|
||||||
`query ADMIN_GET_PAYMENT_BY_ID($paymentId: uuid!) {
|
`query ADMIN_GET_PAYMENT_BY_ID($paymentId: uuid!) {
|
||||||
payments_by_pk(id: $paymentId) {
|
payments_by_pk(id: $paymentId) {
|
||||||
@@ -139,6 +157,10 @@ async function OpenSearchUpdateHandler(req, res) {
|
|||||||
...payment.payments_by_pk,
|
...payment.payments_by_pk,
|
||||||
bodyshopid: payment.payments_by_pk.job.shopid
|
bodyshopid: payment.payments_by_pk.job.shopid
|
||||||
};
|
};
|
||||||
|
logger.log("os-handler-payments", "DEBUG", req.user.email, null, {
|
||||||
|
paymentid: req.body.event.data.new.id,
|
||||||
|
bodyshopid: payment.payments_by_pk.job.shopid
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const payload = {
|
const payload = {
|
||||||
@@ -166,7 +188,9 @@ async function OpenSearchSearchHandler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.log("os-search", "DEBUG", req.user.email, null, {
|
logger.log("os-search", "DEBUG", req.user.email, null, {
|
||||||
search
|
search,
|
||||||
|
index,
|
||||||
|
bodyshopid
|
||||||
});
|
});
|
||||||
|
|
||||||
const BearerToken = req.BearerToken;
|
const BearerToken = req.BearerToken;
|
||||||
|
|||||||
Reference in New Issue
Block a user