MCPcopy
hub / github.com/Dokploy/dokploy / createAuditLog

Function createAuditLog

packages/server/src/services/proprietary/audit-log.ts:25–44  ·  view source on GitHub ↗
(input: CreateAuditLogInput)

Source from the content-addressed store, hash-verified

23 * so a logging failure never breaks the main operation.
24 */
25export const createAuditLog = async (input: CreateAuditLogInput) => {
26 try {
27 const licensed = await hasValidLicense(input.organizationId);
28 if (!licensed) return;
29
30 await db.insert(auditLog).values({
31 organizationId: input.organizationId,
32 userId: input.userId,
33 userEmail: input.userEmail,
34 userRole: input.userRole,
35 action: input.action,
36 resourceType: input.resourceType,
37 resourceId: input.resourceId,
38 resourceName: input.resourceName,
39 metadata: input.metadata ? JSON.stringify(input.metadata) : undefined,
40 });
41 } catch (err) {
42 console.error("[audit-log] Failed to create audit log entry:", err);
43 }
44};
45
46export interface GetAuditLogsInput {
47 organizationId: string;

Callers 2

auth.tsFile · 0.90
auditFunction · 0.90

Calls 1

hasValidLicenseFunction · 0.90

Tested by

no test coverage detected