IO-2933 Add in email for succesful postback from Short URL.

This commit is contained in:
Patrick Fic
2024-09-16 16:02:19 -07:00
parent cbc164dbeb
commit 2a33f462a3
6 changed files with 65 additions and 13 deletions

View File

@@ -96,7 +96,7 @@ const sendServerEmail = async ({ subject, text }) => {
}
};
const sendTaskEmail = async ({ to, subject, text, attachments }) => {
const sendTaskEmail = async ({ to, subject, type = "text", html, text, attachments }) => {
try {
transporter.sendMail(
{
@@ -107,7 +107,7 @@ const sendTaskEmail = async ({ to, subject, text, attachments }) => {
}),
to: to,
subject: subject,
text: text,
...(type === "text" ? { text } : { html }),
attachments: attachments || null
},
(err, info) => {

View File

@@ -94,7 +94,8 @@ const formatPriority = (priority) => {
* @param taskId
* @returns {{header, body: string, subHeader: string}}
*/
const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId) => {
function getEndpoints() {
const endPoints = InstanceManager({
imex: process.env?.NODE_ENV === "test" ? "https://test.imex.online" : "https://imex.online",
rome:
@@ -106,6 +107,10 @@ const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, j
? "https//test.romeonline.io"
: "https://romeonline.io"
});
return endPoints;
}
const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId) => {
const endPoints = getEndpoints();
return {
header: title,
subHeader: `Body Shop: ${bodyshop.shopname} | Priority: ${formatPriority(priority)} ${formatDate(dueDate)}`,
@@ -333,5 +338,6 @@ const tasksRemindEmail = async (req, res) => {
module.exports = {
taskAssignedEmail,
tasksRemindEmail
tasksRemindEmail,
getEndpoints
};