tianji/src/server/model/auditLog.ts

25 lines
513 B
TypeScript
Raw Normal View History

2024-01-22 05:07:46 +00:00
import { WorkspaceAuditLogType } from '@prisma/client';
import { prisma } from './_client';
/**
* create audit log which can query by log
*/
export async function createAuditLog(info: {
workspaceId: string;
relatedId?: string;
relatedType?: WorkspaceAuditLogType;
content: string;
}) {
2024-01-22 05:23:30 +00:00
try {
const log = await prisma.workspaceAuditLog.create({
data: {
...info,
},
});
2024-01-22 05:07:46 +00:00
2024-01-22 05:23:30 +00:00
return log;
} catch (err) {
console.error('[AuditLog] create log error', String(err));
}
2024-01-22 05:07:46 +00:00
}