Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb81d846

Browse files
authored
fix: audit log query when Postgres TZ isn't UTC (coder#6067)
1 parentd9e22d7 commitb81d846

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

‎coderd/audit.go‎

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,10 @@ func (api *API) auditLogs(rw http.ResponseWriter, r *http.Request) {
5757
})
5858
return
5959
}
60+
filter.Offset=int32(page.Offset)
61+
filter.Limit=int32(page.Limit)
6062

61-
dblogs,err:=api.Database.GetAuditLogsOffset(ctx, database.GetAuditLogsOffsetParams{
62-
Offset:int32(page.Offset),
63-
Limit:int32(page.Limit),
64-
ResourceType:filter.ResourceType,
65-
ResourceID:filter.ResourceID,
66-
Action:filter.Action,
67-
Username:filter.Username,
68-
Email:filter.Email,
69-
DateFrom:filter.DateFrom,
70-
DateTo:filter.DateTo,
71-
BuildReason:filter.BuildReason,
72-
})
63+
dblogs,err:=api.Database.GetAuditLogsOffset(ctx,filter)
7364
iferr!=nil {
7465
httpapi.InternalServerError(rw,err)
7566
return

‎coderd/database/queries.sql.go‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/auditlogs.sql‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ WHERE
7676
END
7777
-- Filter by date_from
7878
AND CASE
79-
WHEN @date_from ::timestamp with time zone!='0001-01-01 00:00:00' THEN
79+
WHEN @date_from ::timestamp with time zone!='0001-01-01 00:00:00Z' THEN
8080
"time">= @date_from
8181
ELSE true
8282
END
8383
-- Filter by date_to
8484
AND CASE
85-
WHEN @date_to ::timestamp with time zone!='0001-01-01 00:00:00' THEN
85+
WHEN @date_to ::timestamp with time zone!='0001-01-01 00:00:00Z' THEN
8686
"time"<= @date_to
8787
ELSE true
8888
END

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp