feat: implement hard delete, email notifications, watermark, and fix bulk download

This commit is contained in:
Leon Tonhäuser committed 2026-08-11 12:28:39 +02:00
1 parent 8dd1e10fea
commit 4667615ed0
15 files changed
+369 -65

No files matched your search

+41
View File
@@ -12,6 +12,45 @@ const transporter = nodemailer.createTransport({
},
});
function buildHtml(title: string, content: string, button?: { text: string, url: string }) {
return `<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #f4f4f5; color: #18181b; line-height: 1.6; padding: 20px; }
.container { max-width: 600px; margin: 0 auto; background: #ffffff; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.header { padding: 32px 32px 0 32px; text-align: center; }
.header img { max-height: 64px; }
.content { padding: 32px; font-size: 16px; }
.title { font-size: 24px; font-weight: 700; margin-bottom: 24px; text-align: center; }
.button { display: inline-block; background-color: #18181b; color: #ffffff !important; padding: 14px 28px; text-decoration: none; border-radius: 8px; font-weight: 600; margin-top: 32px; }
.footer { padding: 32px; text-align: center; font-size: 14px; color: #71717a; border-top: 1px solid #e4e4e7; background: #fafafa; }
.footer a { color: #71717a; text-decoration: underline; margin: 0 8px; }
</style>
</head>
<body>
<div class="container">
<div class="header">
<img src="${env.BETTER_AUTH_URL}/brand/logo-black.png" alt="Logo" />
</div>
<div class="content">
<div class="title">${title}</div>
<p style="white-space: pre-line; color: #3f3f46; text-align: center;">${content}</p>
${button ? `<div style="text-align: center;"><a href="${button.url}" class="button">${button.text}</a></div>` : ''}
</div>
<div class="footer">
<p>
<a href="${env.LEGAL_IMPRINT_URL}">Impressum</a> |
<a href="${env.LEGAL_PRIVACY_URL}">Datenschutz</a> |
<a href="${env.LEGAL_TERMS_URL}">AGB</a>
</p>
</div>
</div>
</body>
</html>`;
}
export const emailService = {
async sendBillingReport(toEmail: string, reportMonth: string, pdfBytes: Buffer, invoiceNumber: string) {
const filename = invoiceNumber.replace(/[^A-Za-z0-9_-]/g, "_") + ".pdf";
@@ -21,6 +60,7 @@ export const emailService = {
to: toEmail,
subject: `Ihre Abrechnung für ${reportMonth}`,
text: `Hallo,\n\nanbei erhalten Sie Ihre Abrechnung für den Monat ${reportMonth} als PDF-Dokument.\n\nViele Grüße,\nIhr Redaktions-Team`,
html: buildHtml("Ihre Abrechnung ist da", `Hallo,\n\nanbei erhalten Sie Ihre Abrechnung für den Monat **${reportMonth}** bequem als PDF-Dokument angehängt.\n\nViele Grüße,\nIhr Redaktions-Team`),
attachments: [
{
filename,
@@ -37,6 +77,7 @@ export const emailService = {
to: toEmail,
subject: `Neues Fotoalbum verfügbar: ${albumName}`,
text: `Hallo,\n\nein neues Fotoalbum "${albumName}" wurde für Ihre Redaktion freigegeben. Sie können die Bilder ab sofort im Redaktionsportal ansehen und lizenzieren.\n\nViele Grüße,\nIhr Redaktions-Team`,
html: buildHtml("Neues Album verfügbar", `Hallo,\n\nein neues Fotoalbum **"${albumName}"** wurde soeben für Ihre Redaktion freigegeben.\n\nSie können die Bilder ab sofort im Redaktionsportal ansehen und herunterladen.\n\nViele Grüße,\nIhr Redaktions-Team`, { text: "Zum Portal", url: `${env.BETTER_AUTH_URL}/login` }),
});
},
};