feat: add audit log sqlc queries and generated code

This commit is contained in:
2026-05-26 16:14:14 +02:00
parent 90e7a9323a
commit 51bfc9d2af
5 changed files with 141 additions and 20 deletions

View File

@@ -1,6 +1,18 @@
-- name: GetUser :one
SELECT * FROM user WHERE id = ? LIMIT 1;
-- name: CreateAuditLog :one
INSERT INTO audit_log (id, user_id, action, resource_type, resource_id, ip, user_agent, metadata_json)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
RETURNING *;
-- name: GetAuditLogsForUser :many
SELECT *
FROM audit_log
WHERE user_id = ?
ORDER BY occurred_at DESC
LIMIT ?;
-- name: GetUserByUsername :one
SELECT * FROM user WHERE username = ? LIMIT 1;