15 lines
418 B
TypeScript
15 lines
418 B
TypeScript
import type { Prisma } from '../generated/prisma/client';
|
|
|
|
export function recordAudit(
|
|
tx: Prisma.TransactionClient,
|
|
organizationId: string,
|
|
actorId: string | null,
|
|
action: string,
|
|
targetId: string | null = null,
|
|
) {
|
|
// Deliberately accept no arbitrary payload: passwords and tokens cannot enter audit data.
|
|
return tx.auditEvent.create({
|
|
data: { organizationId, actorId, action, targetId },
|
|
});
|
|
}
|