feat: audit source operations
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
import { db } from "@/lib/db";
|
||||
export function audit(actorUserId: number | null, action: string, targetType: string, targetId?: string | number, metadata: unknown = {}) {
|
||||
db.prepare("INSERT INTO audit_events(actor_user_id,action,target_type,target_id,metadata_json) VALUES(?,?,?,?,?)").run(actorUserId, action, targetType, targetId == null ? null : String(targetId), JSON.stringify(metadata));
|
||||
}
|
||||
Reference in New Issue
Block a user