feat: Add audit log filters in the API (#4078)

This commit is contained in:
Bruno Quaresma
2022-09-19 10:37:33 -03:00
committed by GitHub
parent f314f30ebc
commit bf8d823ae3
8 changed files with 238 additions and 20 deletions
+13
View File
@@ -13,6 +13,19 @@ FROM
audit_logs
LEFT JOIN
users ON audit_logs.user_id = users.id
WHERE
-- Filter resource_type
CASE
WHEN @resource_type :: text != '' THEN
resource_type = @resource_type :: resource_type
ELSE true
END
-- Filter action
AND CASE
WHEN @action :: text != '' THEN
action = @action :: audit_action
ELSE true
END
ORDER BY
"time" DESC
LIMIT