This commit is contained in:
commit
59bb5a38a3
132 files changed
+19435
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import type { ActorType, Prisma } from "@/generated/prisma/client";
|
||||
import type { Db, Tx } from "./db";
|
||||
|
||||
export type Actor = { type: ActorType; id?: string | null };
|
||||
|
||||
export const SYSTEM: Actor = { type: "SYSTEM" };
|
||||
export const STRIPE_ACTOR: Actor = { type: "STRIPE" };
|
||||
export const WORKER: Actor = { type: "WORKER" };
|
||||
export const CUSTOMER: Actor = { type: "CUSTOMER" };
|
||||
|
||||
/**
|
||||
* Protokolliert Buchungs-, Bestands- und Zahlungsaktionen. "details" enthaelt
|
||||
* Betraege, Status und Stripe-IDs — keine Kontaktdaten der Teilnehmerin.
|
||||
*/
|
||||
export async function audit(
|
||||
db: Db | Tx,
|
||||
actor: Actor,
|
||||
action: string,
|
||||
entityType: string,
|
||||
entityId: string,
|
||||
details?: Prisma.InputJsonValue,
|
||||
): Promise<void> {
|
||||
await db.auditLog.create({
|
||||
data: { actorType: actor.type, actorId: actor.id ?? null, action, entityType, entityId, details },
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user