feat(platform): harden access scoping and delivery baseline
This commit is contained in:
@@ -92,6 +92,11 @@ export function generateSummary(
|
||||
export async function createAuditEntry(params: CreateAuditEntryParams): Promise<void> {
|
||||
try {
|
||||
const { db, entityType, entityId, entityName, action, userId, before, after, source, metadata } = params;
|
||||
const auditLog = (db as Partial<PrismaClient>).auditLog;
|
||||
|
||||
if (!auditLog || typeof auditLog.create !== "function") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute diff if both snapshots are available
|
||||
const diff = before && after ? computeDiff(before, after) : undefined;
|
||||
@@ -111,7 +116,7 @@ export async function createAuditEntry(params: CreateAuditEntryParams): Promise<
|
||||
if (diff) changes.diff = diff;
|
||||
if (metadata) changes.metadata = metadata;
|
||||
|
||||
await db.auditLog.create({
|
||||
await auditLog.create({
|
||||
data: {
|
||||
entityType,
|
||||
entityId,
|
||||
|
||||
Reference in New Issue
Block a user