public
anord
read
Ledger
Why work hard when you can work easier?
Languages
Repository composition by tracked source files.
TypeScript
86%
CSS
10%
SQL
3%
Shell
1%
HTML
0%
Trace
apps/api/src/services/audit.ts
Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.
Author
Date
Commit
Line
Code
1
import { pool } from "../db/pool.js";
3
export async function logAudit(
4
actorUserId: string | null,
5
action: string,
6
resourceType: string,
7
resourceId: string,
8
metadata: Record<string, unknown> = {}
9
) {
10
await pool.query(
11
`INSERT INTO audit_logs (actor_user_id, action, resource_type, resource_id, metadata)
12
VALUES ($1, $2, $3, $4, $5)`,
13
[actorUserId, action, resourceType, resourceId, JSON.stringify(metadata)]
14
);
15
}