feat(diagnostics): correlate staff operations errors and audit records
CI / check (push) Successful in 56s
CI / deploy (push) Successful in 19s
CI / publish-container (push) Successful in 1m15s

This commit is contained in:
Simo committed 2026-09-11 00:34:49 +02:00
1 parent 440ce4e556
commit a2954e4408
14 files changed
+473 -110

No files matched your search

+5 -2
View File
@@ -8,6 +8,7 @@ import {
WebsiteArticles,
} from "@/db/schema";
import type { db } from "@/lib/db";
import { getOperationContext } from "@/lib/foundation/request-context";
import { type HistorySnapshot, sameSnapshot } from "./model";
export type HistoryKind = "category" | "category_bc" | "prices" | "news";
export type HistoryTransaction = Parameters<
@@ -117,8 +118,10 @@ export async function recordHistory(
action,
target: kind,
targetId: Number(id) <= 2147483647 ? Number(id) : null,
details:
Number(id) > 2147483647 ? JSON.stringify({ targetId: String(id) }) : null,
details: JSON.stringify({
...getOperationContext(),
...(Number(id) > 2147483647 ? { targetId: String(id) } : {}),
}),
before: serializedBefore,
after: serializedAfter,
createdAt: new Date().toISOString(),