Add logging when manually changing the hc status

This commit is contained in:
Owen
2026-04-26 17:28:57 -07:00
parent 06af53c4d6
commit ca2370e31d
21 changed files with 170 additions and 45 deletions

View File

@@ -6,7 +6,7 @@ import {
} from "@server/db";
import { eq } from "drizzle-orm";
import logger from "@server/logger";
import { fireSiteOfflineAlert } from "@server/lib/alerts";
import { fireSiteOfflineAlert } from "#dynamic/lib/alerts";
/**
* Handles disconnecting messages from sites to show disconnected in the ui

View File

@@ -1,10 +1,7 @@
import {
db,
newts,
sites,
targetHealthCheck,
targets,
statusHistory
sites
} from "@server/db";
import { hasActiveConnections } from "#dynamic/routers/ws";
import { eq, lt, isNull, and, or, ne, not, inArray } from "drizzle-orm";

View File

@@ -1,6 +1,6 @@
import { Request, Response, NextFunction } from "express";
import { z } from "zod";
import { db } from "@server/db";
import { db, statusHistory } from "@server/db";
import {
siteProvisioningKeys,
siteProvisioningKeyOrg,
@@ -223,6 +223,14 @@ export async function registerNewt(
})
.returning();
await trx.insert(statusHistory).values({
entityType: "site",
entityId: newSite.siteId,
orgId: orgId,
status: "offline",
timestamp: Math.floor(Date.now() / 1000)
});
newSiteId = newSite.siteId;
// Grant admin role access to the new site