Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions coderd/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,10 @@ func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) {
})
return
}
filter.Offset = int32(page.Offset)
filter.Limit = int32(page.Limit)

dblogs, err := api.Database.GetAuditLogsOffset(ctx, database.GetAuditLogsOffsetParams{
Offset: int32(page.Offset),
Limit: int32(page.Limit),
ResourceType: filter.ResourceType,
ResourceID: filter.ResourceID,
Action: filter.Action,
Username: filter.Username,
Email: filter.Email,
DateFrom: filter.DateFrom,
DateTo: filter.DateTo,
BuildReason: filter.BuildReason,
})
dblogs, err := api.Database.GetAuditLogsOffset(ctx, filter)
if err != nil {
httpapi.InternalServerError(rw, err)
return
Expand Down
4 changes: 2 additions & 2 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions coderd/database/queries/auditlogs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ WHERE
END
-- Filter by date_from
AND CASE
WHEN @date_from :: timestamp with time zone != '0001-01-01 00:00:00' THEN
WHEN @date_from :: timestamp with time zone != '0001-01-01 00:00:00Z' THEN
"time" >= @date_from
ELSE true
END
-- Filter by date_to
AND CASE
WHEN @date_to :: timestamp with time zone != '0001-01-01 00:00:00' THEN
WHEN @date_to :: timestamp with time zone != '0001-01-01 00:00:00Z' THEN
"time" <= @date_to
ELSE true
END
Expand Down