From bdaf8c60217084e83b11c85ff5daf506aa042aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Thu, 7 Nov 2024 17:07:50 +0100 Subject: [PATCH] fix: email wording --- webapp/src/server/api/routers/order.ts | 5 +++-- webapp/src/utils/emailHtml.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/webapp/src/server/api/routers/order.ts b/webapp/src/server/api/routers/order.ts index 4218ae4b..da17ffaf 100644 --- a/webapp/src/server/api/routers/order.ts +++ b/webapp/src/server/api/routers/order.ts @@ -386,6 +386,7 @@ export const orderRouter = createTRPCRouter({ data: { order: id, }, + depth: 1, }); const users = await ctx.payload.find({ @@ -401,8 +402,8 @@ export const orderRouter = createTRPCRouter({ ctx.payload.sendEmail({ from: process.env.SMTP_FROM_ADDRESS, to: currentUser.userEmail, - subject: 'Signalement d\'une commande sur la carte "jeune engagé"', - html: getHtmlSignalOrder(currentUser), + subject: "Signalement d'une commande défaillante", + html: getHtmlSignalOrder(currentUser, orderSignal.order as Order), }); return { diff --git a/webapp/src/utils/emailHtml.ts b/webapp/src/utils/emailHtml.ts index 2c0e6d58..175eb177 100644 --- a/webapp/src/utils/emailHtml.ts +++ b/webapp/src/utils/emailHtml.ts @@ -1,5 +1,5 @@ import { formatDateTime, getBaseUrl } from "./tools"; -import { User } from "~/payload/payload-types"; +import { Order, User } from "~/payload/payload-types"; export const getHtmlLoginByEmail = (user: User, userAuthToken: string) => { return ` @@ -70,7 +70,7 @@ export const getHtmlLoginByEmail = (user: User, userAuthToken: string) => { `; }; -export const getHtmlSignalOrder = (user: User) => { +export const getHtmlSignalOrder = (user: User, order: Order) => { const now = new Date(); return ` @@ -129,7 +129,10 @@ export const getHtmlSignalOrder = (user: User) => {
-

Date de votre demande : ${formatDateTime(now)} +

+ Numéro de commande : ${order.number}
+ Date de votre demande : ${formatDateTime(now)} +