feat(nextcloud-status): Benachrichtigung abonnieren und Mail bei Störung
- Glocke je Kachel (persönlich, Benutzen-Ebene), Tabelle NextcloudAlertSubscription mit RLS - Zwei-Fehlschläge-Regel und gemeldeter Zustand auf der Zeile, Anspruch vor dem Mailversand - Mail (nur Deutsch) über MailService, bis zu drei Versuche, Zugriff beim Senden erneut geprüft - Fehlercodes in der Mail als lesbarer Hinweis Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,10 @@ import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import * as nodemailer from 'nodemailer';
|
||||
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
||||
import {
|
||||
buildNextcloudAlertMail,
|
||||
type NextcloudAlertMailInput,
|
||||
} from '../nextcloud-status/nextcloud-alert-mail';
|
||||
import { SettingsService } from '../settings/settings.service';
|
||||
|
||||
/**
|
||||
@@ -406,4 +410,29 @@ export class MailService {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Benachrichtigung des Moduls Nextcloud-Status (quick-261002-kxc, L-04/L-05):
|
||||
* Stoerung oder "wieder in Ordnung" einer Cloud. Text und Betreff baut der
|
||||
* reine Baustein `buildNextcloudAlertMail` (nur Deutsch, wie die
|
||||
* Erinnerungsmails). Liefert true bei Erfolg, false (und ein Protokolleintrag)
|
||||
* bei Transportfehlern — der Aufrufer entscheidet ueber Wiederholungen.
|
||||
*/
|
||||
async sendNextcloudAlertEmail(
|
||||
tenantId: string,
|
||||
to: string,
|
||||
input: NextcloudAlertMailInput,
|
||||
): Promise<boolean> {
|
||||
const { subject, text } = buildNextcloudAlertMail(input, this.appUrl);
|
||||
try {
|
||||
await this.deliver(tenantId, { to, subject, text }, 'NextcloudAlert');
|
||||
return true;
|
||||
} catch (error) {
|
||||
this.logger.error(
|
||||
`Failed to send NextcloudAlert email to ${to}`,
|
||||
error instanceof Error ? error.stack : String(error),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user