Bulk snooze, alert rules judged on report, photos on notes

Bulk snooze: Snooze... and Wake on the ticked alerts, with undo that puts back
each alert's earlier snooze exactly.

Alert rules are judged for a server right after its agent reports, instead of at
the next 15-minute pass; only that server's rule findings change, and the check
is serialized with the pass so neither overwrites the other's state.

Photos on server and device notes: up to 12 each, shrunk in the browser,
accepted by their own bytes (JPEG/PNG/GIF/WebP, 4 MB), kept in the database and
removed with the server or device.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-24 22:53:09 +02:00
1 parent 251a4a9d73
commit a16996d975
27 files changed
+8442 -54

No files matched your search

+20 -1
View File
@@ -1,5 +1,5 @@
import { sql } from "drizzle-orm";
import { sqliteTable, text, integer, real, uniqueIndex, index, primaryKey } from "drizzle-orm/sqlite-core";
import { sqliteTable, text, integer, real, blob, uniqueIndex, index, primaryKey } from "drizzle-orm/sqlite-core";
// ─── Users & roles ──────────────────────────────────────────────────────────
@@ -1424,6 +1424,25 @@ export const notes = sqliteTable(
(t) => [uniqueIndex("notes_target_idx").on(t.targetType, t.targetId)],
);
// Photos on a note — the rack as it is, a cable's label, the back of the NAS. Kept in the database itself, so a database backup has them and nothing else needs a volume; each is
// one server's or one device's, with a foreign key that cascades, so removing the server removes its photos. The bytes are exactly what the browser sent (it makes them small first),
// and only a JPEG, PNG, GIF or WebP is accepted, told by what the bytes are and not by what the upload says it is.
export const notePhotos = sqliteTable(
"note_photos",
{
id: integer("id").primaryKey({ autoIncrement: true }),
serverId: integer("server_id").references(() => servers.id, { onDelete: "cascade" }),
deviceId: integer("device_id").references(() => networkDevices.id, { onDelete: "cascade" }),
contentType: text("content_type").notNull(),
data: blob("data", { mode: "buffer" }).notNull(),
size: integer("size").notNull(),
caption: text("caption"),
createdBy: text("created_by"),
createdAt: text("created_at").notNull(), // ISO
},
(t) => [index("note_photos_server_idx").on(t.serverId), index("note_photos_device_idx").on(t.deviceId)],
);
// Things to do: the small jobs of a homelab ("replace the UPS battery", "move the NAS to the new switch"), with a day they are due and optionally a person and
// a thing they are about. Open ones with a due day are in Coming up; the ones handed to someone are in My work.
export const todos = sqliteTable("todos", {