Rewritten to use drizzle instead of prisma
commit c0894548dac5133bd89da5b68684443748fa2559 Author: fuomag9 <1580624+fuomag9@users.noreply.github.com> Date: Fri Nov 7 18:38:30 2025 +0100 Update config.ts commit 5a4f1159d2123ada0f698a10011c24720bf6ea6f Author: fuomag9 <1580624+fuomag9@users.noreply.github.com> Date: Fri Nov 7 15:58:13 2025 +0100 first drizzle rewrite
This commit is contained in:
+8
-7
@@ -1,4 +1,5 @@
|
||||
import prisma, { nowIso } from "./db";
|
||||
import db, { nowIso } from "./db";
|
||||
import { auditEvents } from "./db/schema";
|
||||
|
||||
export function logAuditEvent(params: {
|
||||
userId?: number | null;
|
||||
@@ -8,18 +9,18 @@ export function logAuditEvent(params: {
|
||||
summary?: string | null;
|
||||
data?: unknown;
|
||||
}) {
|
||||
prisma.auditEvent.create({
|
||||
data: {
|
||||
try {
|
||||
db.insert(auditEvents).values({
|
||||
userId: params.userId ?? null,
|
||||
action: params.action,
|
||||
entityType: params.entityType,
|
||||
entityId: params.entityId ?? null,
|
||||
summary: params.summary ?? null,
|
||||
data: params.data ? JSON.stringify(params.data) : null,
|
||||
createdAt: new Date(nowIso())
|
||||
}
|
||||
}).catch((error: unknown) => {
|
||||
createdAt: nowIso()
|
||||
}).run();
|
||||
} catch (error) {
|
||||
// Log error but don't throw to avoid breaking the main flow
|
||||
console.error("Failed to log audit event:", error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user