Merge branch 'release/AIO/2024-04-26' into test-AIO
This commit is contained in:
@@ -51,6 +51,17 @@ export function JobsAvailablePageContainer({ partnerVersion, setBreadcrumbs, set
|
|||||||
{!partnerVersion && (
|
{!partnerVersion && (
|
||||||
<AlertComponent
|
<AlertComponent
|
||||||
type="warning"
|
type="warning"
|
||||||
|
action={
|
||||||
|
<a
|
||||||
|
href={InstanceRenderManager({
|
||||||
|
imex: "https://partner.imex.online/Setup.exe",
|
||||||
|
rome: "https://partner.romeonline.io/Setup.exe",
|
||||||
|
promanager: "https://dzaenazwrgg60.cloudfront.net/Setup.exe"
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<Button size="small">{t("general.actions.download")}</Button>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
message={t("general.messages.partnernotrunning", {
|
message={t("general.messages.partnernotrunning", {
|
||||||
app: InstanceRenderManager({
|
app: InstanceRenderManager({
|
||||||
imex: "$t(titles.imexonline)",
|
imex: "$t(titles.imexonline)",
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ const INITIAL_STATE = {
|
|||||||
name: "ShopName",
|
name: "ShopName",
|
||||||
address: InstanceRenderManager({
|
address: InstanceRenderManager({
|
||||||
imex: "noreply@iemx.online",
|
imex: "noreply@iemx.online",
|
||||||
rome: "noreply@romeonline.io"
|
rome: "noreply@romeonline.io",
|
||||||
|
promanager: "noreply@promanager.web-est.com"
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
to: null,
|
to: null,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { auth } from "../firebase/firebase.utils";
|
import { auth } from "../firebase/firebase.utils";
|
||||||
|
import InstanceRenderManager from "./instanceRenderMgr";
|
||||||
|
|
||||||
axios.defaults.baseURL =
|
axios.defaults.baseURL =
|
||||||
import.meta.env.VITE_APP_AXIOS_BASE_API_URL ||
|
import.meta.env.VITE_APP_AXIOS_BASE_API_URL ||
|
||||||
@@ -12,6 +13,13 @@ export const axiosAuthInterceptorId = axios.interceptors.request.use(
|
|||||||
if (token) {
|
if (token) {
|
||||||
config.headers.Authorization = `Bearer ${token}`;
|
config.headers.Authorization = `Bearer ${token}`;
|
||||||
}
|
}
|
||||||
|
InstanceRenderManager({
|
||||||
|
executeFunction: true,
|
||||||
|
args: [],
|
||||||
|
promanager: () => {
|
||||||
|
config.headers["Convenient-Company"] = "promanager";
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
@@ -920,6 +920,7 @@
|
|||||||
- cdk_dealerid
|
- cdk_dealerid
|
||||||
- city
|
- city
|
||||||
- claimscorpid
|
- claimscorpid
|
||||||
|
- convenient_company
|
||||||
- country
|
- country
|
||||||
- created_at
|
- created_at
|
||||||
- default_adjustment_rate
|
- default_adjustment_rate
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
-- Could not auto-generate a down migration.
|
||||||
|
-- Please write an appropriate down migration for the SQL below:
|
||||||
|
-- alter table "public"."bodyshops" add column "convenient_company" text
|
||||||
|
-- null;
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
alter table "public"."bodyshops" add column "convenient_company" text
|
||||||
|
null;
|
||||||
@@ -24,7 +24,7 @@ const ses = new aws.SES({
|
|||||||
|
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
SES: { ses, aws },
|
SES: { ses, aws },
|
||||||
sendingRate: 40 // 40 emails per second.
|
sendingRate: InstanceManager({ imex: 40, rome: 10 })
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize the Tasks Email Queue
|
// Initialize the Tasks Email Queue
|
||||||
@@ -41,38 +41,28 @@ const tasksEmailQueueCleanup = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handling SIGINT (e.g., Ctrl+C)
|
if (process.env.NODE_ENV !== "development") {
|
||||||
process.on("SIGINT", async () => {
|
// Handling SIGINT (e.g., Ctrl+C)
|
||||||
await tasksEmailQueueCleanup();
|
process.on("SIGINT", async () => {
|
||||||
process.exit(0);
|
await tasksEmailQueueCleanup();
|
||||||
});
|
process.exit(0);
|
||||||
// Handling SIGTERM (e.g., sent by system shutdown)
|
});
|
||||||
process.on("SIGTERM", async () => {
|
// Handling SIGTERM (e.g., sent by system shutdown)
|
||||||
await tasksEmailQueueCleanup();
|
process.on("SIGTERM", async () => {
|
||||||
process.exit(0);
|
await tasksEmailQueueCleanup();
|
||||||
});
|
process.exit(0);
|
||||||
// Handling uncaught exceptions
|
});
|
||||||
process.on("uncaughtException", async (err) => {
|
// Handling uncaught exceptions
|
||||||
await tasksEmailQueueCleanup();
|
process.on("uncaughtException", async (err) => {
|
||||||
process.exit(1); // Exit with an 'error' code
|
await tasksEmailQueueCleanup();
|
||||||
});
|
process.exit(1); // Exit with an 'error' code
|
||||||
// Handling unhandled promise rejections
|
});
|
||||||
process.on("unhandledRejection", async (reason, promise) => {
|
// Handling unhandled promise rejections
|
||||||
await tasksEmailQueueCleanup();
|
process.on("unhandledRejection", async (reason, promise) => {
|
||||||
process.exit(1); // Exit with an 'error' code
|
await tasksEmailQueueCleanup();
|
||||||
});
|
process.exit(1); // Exit with an 'error' code
|
||||||
|
});
|
||||||
const fromEmails = InstanceManager({
|
}
|
||||||
imex: "ImEX Online <noreply@imex.online>",
|
|
||||||
rome: "Rome Online <noreply@romeonline.io>",
|
|
||||||
promanager: "ProManager <noreply@promanager.web-est.com>"
|
|
||||||
});
|
|
||||||
|
|
||||||
const endPoints = InstanceManager({
|
|
||||||
imex: process.env?.NODE_ENV === "test" ? "https://test.imex.online" : "https://imex.online",
|
|
||||||
rome: process.env?.NODE_ENV === "test" ? "https//test.romeonline.io" : "https://romeonline.io",
|
|
||||||
promanager: process.env?.NODE_ENV === "test" ? "https//test.promanager.web-est.com" : "https://promanager.web-est.com"
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format the date for the email.
|
* Format the date for the email.
|
||||||
@@ -105,6 +95,17 @@ const formatPriority = (priority) => {
|
|||||||
* @returns {{header, body: string, subHeader: string}}
|
* @returns {{header, body: string, subHeader: string}}
|
||||||
*/
|
*/
|
||||||
const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId) => {
|
const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, job, taskId) => {
|
||||||
|
const endPoints = InstanceManager({
|
||||||
|
imex: process.env?.NODE_ENV === "test" ? "https://test.imex.online" : "https://imex.online",
|
||||||
|
rome:
|
||||||
|
bodyshop.convenient_company === "promanager"
|
||||||
|
? process.env?.NODE_ENV === "test"
|
||||||
|
? "https//test.promanager.web-est.com"
|
||||||
|
: "https://promanager.web-est.com"
|
||||||
|
: process.env?.NODE_ENV === "test"
|
||||||
|
? "https//test.romeonline.io"
|
||||||
|
: "https://romeonline.io"
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
header: title,
|
header: title,
|
||||||
subHeader: `Body Shop: ${bodyshop.shopname} | Priority: ${formatPriority(priority)} ${formatDate(dueDate)}`,
|
subHeader: `Body Shop: ${bodyshop.shopname} | Priority: ${formatPriority(priority)} ${formatDate(dueDate)}`,
|
||||||
@@ -121,12 +122,15 @@ const generateTemplateArgs = (title, priority, description, dueDate, bodyshop, j
|
|||||||
* @param taskIds
|
* @param taskIds
|
||||||
* @param successCallback
|
* @param successCallback
|
||||||
*/
|
*/
|
||||||
const sendMail = (type, to, subject, html, taskIds, successCallback) => {
|
const sendMail = (type, to, subject, html, taskIds, successCallback, requestInstance) => {
|
||||||
// Push next messages to Nodemailer
|
const fromEmails = InstanceManager({
|
||||||
//transporter.once("idle", () => {
|
imex: "ImEX Online <noreply@imex.online>",
|
||||||
// Note: This is commented out because despite being in the documentation, it does not work
|
rome:
|
||||||
// and stackoverflow suggests it is not needed
|
requestInstance === "promanager"
|
||||||
// if (transporter.isIdle()) {
|
? "ProManager <noreply@promanager.web-est.com>"
|
||||||
|
: "Rome Online <noreply@romeonline.io>"
|
||||||
|
});
|
||||||
|
|
||||||
transporter.sendMail(
|
transporter.sendMail(
|
||||||
{
|
{
|
||||||
from: fromEmails,
|
from: fromEmails,
|
||||||
@@ -184,7 +188,8 @@ const taskAssignedEmail = async (req, res) => {
|
|||||||
tasks_by_pk.job,
|
tasks_by_pk.job,
|
||||||
newTask.id
|
newTask.id
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
tasks_by_pk.bodyshop.convenient_company
|
||||||
);
|
);
|
||||||
|
|
||||||
// We return success regardless because we don't want to block the event trigger.
|
// We return success regardless because we don't want to block the event trigger.
|
||||||
@@ -233,6 +238,14 @@ const tasksRemindEmail = async (req, res) => {
|
|||||||
|
|
||||||
// Iterate over all recipients and send the email.
|
// Iterate over all recipients and send the email.
|
||||||
recipientCounts.forEach((recipient) => {
|
recipientCounts.forEach((recipient) => {
|
||||||
|
const fromEmails = InstanceManager({
|
||||||
|
imex: "ImEX Online <noreply@imex.online>",
|
||||||
|
rome:
|
||||||
|
onlyTask.bodyshop.convenient_company === "promanager"
|
||||||
|
? "ProManager <noreply@promanager.web-est.com>"
|
||||||
|
: "Rome Online <noreply@romeonline.io>"
|
||||||
|
});
|
||||||
|
|
||||||
const emailData = {
|
const emailData = {
|
||||||
from: fromEmails,
|
from: fromEmails,
|
||||||
to: recipient.email
|
to: recipient.email
|
||||||
@@ -261,6 +274,18 @@ const tasksRemindEmail = async (req, res) => {
|
|||||||
}
|
}
|
||||||
// There are multiple emails to send to this author.
|
// There are multiple emails to send to this author.
|
||||||
else {
|
else {
|
||||||
|
const endPoints = InstanceManager({
|
||||||
|
imex: process.env?.NODE_ENV === "test" ? "https://test.imex.online" : "https://imex.online",
|
||||||
|
rome:
|
||||||
|
allTasks[0].bodyshop.convenient_company === "promanager"
|
||||||
|
? process.env?.NODE_ENV === "test"
|
||||||
|
? "https//test.promanager.web-est.com"
|
||||||
|
: "https://promanager.web-est.com"
|
||||||
|
: process.env?.NODE_ENV === "test"
|
||||||
|
? "https//test.romeonline.io"
|
||||||
|
: "https://romeonline.io"
|
||||||
|
});
|
||||||
|
|
||||||
const allTasks = groupedTasks[recipient.email];
|
const allTasks = groupedTasks[recipient.email];
|
||||||
emailData.subject = `New Tasks Reminder - ${allTasks.length} Tasks require your attention`;
|
emailData.subject = `New Tasks Reminder - ${allTasks.length} Tasks require your attention`;
|
||||||
emailData.html = generateEmailTemplate({
|
emailData.html = generateEmailTemplate({
|
||||||
|
|||||||
@@ -2431,6 +2431,7 @@ exports.QUERY_REMIND_TASKS = `
|
|||||||
jobid
|
jobid
|
||||||
bodyshop {
|
bodyshop {
|
||||||
shopname
|
shopname
|
||||||
|
convenient_company
|
||||||
}
|
}
|
||||||
bodyshopid
|
bodyshopid
|
||||||
}
|
}
|
||||||
@@ -2453,6 +2454,7 @@ query QUERY_TASK_BY_ID($id: uuid!) {
|
|||||||
}
|
}
|
||||||
bodyshop{
|
bodyshop{
|
||||||
shopname
|
shopname
|
||||||
|
convenient_company
|
||||||
}
|
}
|
||||||
job{
|
job{
|
||||||
ro_number
|
ro_number
|
||||||
|
|||||||
Reference in New Issue
Block a user