mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
feat: audit log api (#3898)
This commit is contained in:
@ -1,16 +1,29 @@
|
||||
-- GetAuditLogsBefore retrieves `limit` number of audit logs before the provided
|
||||
-- GetAuditLogsBefore retrieves `row_limit` number of audit logs before the provided
|
||||
-- ID.
|
||||
-- name: GetAuditLogsBefore :many
|
||||
-- name: GetAuditLogsOffset :many
|
||||
SELECT
|
||||
*
|
||||
audit_logs.*,
|
||||
users.username AS user_username,
|
||||
users.email AS user_email,
|
||||
users.created_at AS user_created_at,
|
||||
users.status AS user_status,
|
||||
users.rbac_roles AS user_roles
|
||||
FROM
|
||||
audit_logs
|
||||
WHERE
|
||||
audit_logs."time" < COALESCE((SELECT "time" FROM audit_logs a WHERE a.id = sqlc.arg(id)), sqlc.arg(start_time))
|
||||
LEFT JOIN
|
||||
users ON audit_logs.user_id = users.id
|
||||
ORDER BY
|
||||
"time" DESC
|
||||
LIMIT
|
||||
sqlc.arg(row_limit);
|
||||
$1
|
||||
OFFSET
|
||||
$2;
|
||||
|
||||
-- name: GetAuditLogCount :one
|
||||
SELECT
|
||||
COUNT(*) as count
|
||||
FROM
|
||||
audit_logs;
|
||||
|
||||
-- name: InsertAuditLog :one
|
||||
INSERT INTO
|
||||
|
Reference in New Issue
Block a user