Alert system

This commit is contained in:
Marcelo
2026-01-15 21:03:41 +00:00
parent 9f1af71d15
commit 0f88207f3f
20 changed files with 1791 additions and 145 deletions

View File

@@ -86,6 +86,7 @@ export async function POST(req: Request) {
// 5) Store heartbeat
// Keep your legacy fields, but store meta fields too.
const tsServerNow = new Date();
const hb = await prisma.machineHeartbeat.create({
data: {
orgId,
@@ -95,6 +96,7 @@ export async function POST(req: Request) {
schemaVersion,
seq,
ts: tsDeviceDate,
tsServer: tsServerNow,
// Legacy payload compatibility
status: body.status ? String(body.status) : (body.online ? "RUN" : "STOP"),
@@ -111,7 +113,7 @@ export async function POST(req: Request) {
schemaVersion,
seq,
tsDevice: tsDeviceDate,
tsServer: new Date(),
tsServer: tsServerNow,
},
});