Skip to content

Commit

Permalink
Log sent to
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Dec 22, 2024
1 parent 94effb1 commit cfbf44c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions apps/dashboard/jobs/tasks/invoice/email/send-email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const sendInvoiceEmail = schemaTask({
const { data: invoice } = await supabase
.from("invoices")
.select(
"id, token, sent_to, customer:customer_id(name, website, email), team:team_id(name, email)",
"id, token, customer:customer_id(name, website, email), team:team_id(name, email)",
)
.eq("id", invoiceId)
.single();
Expand All @@ -32,10 +32,10 @@ export const sendInvoiceEmail = schemaTask({
return;
}

await resend.emails.send({
const response = await resend.emails.send({
from: "Midday <[email protected]>",
to: invoice?.customer.email,
reply_to: invoice?.team.email,
replyTo: invoice?.team.email,
subject: `${invoice?.team.name} sent you an invoice`,
headers: {
"X-Entity-Ref-ID": nanoid(),
Expand All @@ -49,6 +49,11 @@ export const sendInvoiceEmail = schemaTask({
),
});

logger.info("Invoice email sent", {
invoiceId,
response,
});

await supabase
.from("invoices")
.update({
Expand Down

0 comments on commit cfbf44c

Please sign in to comment.