This commit is contained in:
Moritz Utcke
2025-03-07 16:24:24 -03:00
parent 096f325292
commit c4de916057
3 changed files with 24 additions and 20 deletions

View File

@@ -6,9 +6,11 @@ import {
Enums,
Rechnung,
VerbrauchsausweisWohnen,
} from "#lib/client/prisma";
import { prisma } from "#lib/server/prisma";
} from "#lib/client/prisma.js";
import { prisma } from "#lib/server/prisma.js";
import { getAnsichtsausweis } from "../ausweis.js";
import Mail from "nodemailer/lib/mailer/index.js";
import { sqids } from "#client/lib/helpers.js";
export async function sendInvoiceMail(
ausweis: VerbrauchsausweisWohnen,
@@ -33,7 +35,7 @@ export async function sendInvoiceMail(
const ausweisart = getAusweisartFromUUID(ausweis.uid);
const attachments: any[] = [];
const attachments: Mail.Attachment[] = [];
if (ausweisart != Enums.Ausweisart.BedarfsausweisWohnen) {
const ansichtsausweis = await getAnsichtsausweis(
@@ -46,15 +48,15 @@ export async function sendInvoiceMail(
);
if (ansichtsausweis) {
attachments.push([
attachments.push(
{
filename: "Ansichtsausweis.pdf",
filename: `ID_${ausweis.id}_Ansichtsausweis.pdf`,
encoding: "binary",
content: Buffer.from(ansichtsausweis),
contentType: "application/pdf",
contentDisposition: "attachment",
},
]);
);
}
}
@@ -62,7 +64,7 @@ export async function sendInvoiceMail(
attachments,
from: `"IBCornelsen" <info@online-energieausweis.org>`,
to: user.email,
subject: `Bestellbestätigung vom IBCornelsen (ID: ${ausweis.uid})`,
subject: `Bestellbestätigung vom IBCornelsen (ID: ${ausweis.id})`,
cc: {
address: rechnung.email || "",
name: rechnung.empfaenger || "",