Skip to content

Commit

Permalink
fix(template): update mail template of a new contribution by adding f…
Browse files Browse the repository at this point in the history
…onctions
  • Loading branch information
Mihoub2 committed Nov 5, 2024
1 parent 8e73e75 commit 286a433
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 5 additions & 2 deletions server/routes/contacts/post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ postContactsRoutes.post(
...acc,
[key]: body.extra ? body.extra[key].toLowerCase() : "",
}),
{}
{} as { [key: string]: string }
);
const _id = new ObjectId();
const newContribution = {
Expand Down Expand Up @@ -75,7 +75,7 @@ postContactsRoutes.post(
code: "NO_RECIPIENTS_FOUND",
});
}

const fonction = finalContribution.extra.fonction || "non renseigné";
const dataForBrevo = {
sender: {
email: process.env.MAIL_SENDER,
Expand All @@ -88,6 +88,9 @@ postContactsRoutes.post(
params: {
date: new Date().toLocaleDateString("fr-FR"),
title: "Nouvelle contribution créée via formulaire de contact",
name: finalContribution.name,
email: finalContribution.email,
fonction: fonction,
id: finalContribution.id,
link: contributionLink,
message: `${finalContribution.message}`,
Expand Down
6 changes: 5 additions & 1 deletion server/routes/contributionObjectRoutes/post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ postContributionObjectRoutes.post(
...acc,
[key]: body.extra ? body.extra[key].toLowerCase() : "",
}),
{}
{} as { [key: string]: string }
);

const _id = new ObjectId();
Expand Down Expand Up @@ -68,6 +68,7 @@ postContributionObjectRoutes.post(
const recipients = emailRecipients["contribute"] || {
to: process.env.SCANR_EMAIL_RECIPIENTS?.split(",") || [],
};
const fonction = finalContribution.extra.fonction || "non renseigné";

const dataForBrevo = {
sender: {
Expand All @@ -86,6 +87,9 @@ postContributionObjectRoutes.post(
title: "Nouvelle contribution créée concernant un objet",
id: finalContribution.id,
link: contributionLink,
name: finalContribution.name,
fonction: fonction,
email: finalContribution.email,
message: `${finalContribution.message}`,
},
};
Expand Down
6 changes: 5 additions & 1 deletion server/routes/remove-user/post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ postRemoveUserRoutes.post(
...acc,
[key]: body.extra ? body.extra[key].toLowerCase() : "",
}),
{}
{} as { [key: string]: string }
);

const _id = new ObjectId();
Expand Down Expand Up @@ -58,6 +58,7 @@ postRemoveUserRoutes.post(
const recipients = emailRecipients["remove-user"] || {
to: process.env.SCANR_EMAIL_RECIPIENTS?.split(",") || [],
};
const fonction = finalContribution.extra.fonction || "non renseigné";

const dataForBrevo = {
sender: {
Expand All @@ -76,6 +77,9 @@ postRemoveUserRoutes.post(
title: "Nouvelle demande de suppression de profil",
id: finalContribution.id,
link: contributionLink,
name: finalContribution.name,
email: finalContribution.email,
fonction: fonction,
message: `${finalContribution.message}`,
},
};
Expand Down
6 changes: 5 additions & 1 deletion server/routes/update-user-data/post/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ postUpdateUserDataRoutes.post(
...acc,
[key]: body.extra ? body.extra[key].toLowerCase() : "",
}),
{}
{} as { [key: string]: string }
);

const _id = new ObjectId();
Expand Down Expand Up @@ -64,6 +64,7 @@ postUpdateUserDataRoutes.post(
const recipients = emailRecipients["update-user-data"] || {
to: process.env.SCANR_EMAIL_RECIPIENTS?.split(",") || [],
};
const fonction = finalContribution.extra.fonction || "non renseigné";

const dataForBrevo = {
sender: {
Expand All @@ -82,6 +83,9 @@ postUpdateUserDataRoutes.post(
title: "Nouvelle demande de modification de profil",
id: finalContribution.id,
link: contributionLink,
name: finalContribution.name,
email: finalContribution.email,
fonction: fonction,
message: `${finalContribution.message}`,
},
};
Expand Down

0 comments on commit 286a433

Please sign in to comment.