Add a notification history

Every notification is written down with how it went through each channel
(or why it was not sent: held for quiet hours, a routing rule said nobody, no
channel on). Records -> Notifications lists them with a filter, a search and
Send again. Errors are cleaned of every secret in the settings; kept 30 days.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-10 19:18:08 +01:00
1 parent 5c6ccc0a4b
commit 9126200295
18 files changed
+9886 -34

No files matched your search

+16
View File
@@ -1662,6 +1662,22 @@ export const jellyfinReadings = sqliteTable(
// ─── Duplicati ──────────────────────────────────────────────────────────────
// What was sent: one row for each notification, with how it went through each channel, so "why did I not get it?" has an answer. Kept 30 days and at most 1000 rows (services/notificationLog.ts).
export const notificationLog = sqliteTable(
"notification_log",
{
id: integer("id").primaryKey({ autoIncrement: true }),
at: text("at").notNull(), // ISO
title: text("title").notNull(),
message: text("message").notNull(), // cut at 4000 characters
status: text("status").notNull(), // sent | partly | failed | none (no channel to send it to) | held (quiet hours or away) | muted (a routing rule says nobody)
results: text("results").notNull().default("[]"), // JSON: [{ channel, ok, error }]
note: text("note"), // why it was held or muted
resentOf: integer("resent_of"), // the entry it is a resend of
},
(t) => [index("notification_log_at_idx").on(t.at)],
);
// A Duplicati that reports to this app: one row per machine running it, with the secret token its reports carry in their address (only the hash is kept). Duplicati pushes a
// report after every operation (its own "send-http-url" option); services/duplicati.ts reads them.
export const duplicatiSources = sqliteTable("duplicati_sources", {