Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
PR feedback
  • Loading branch information
Kira-Pilot committed Nov 3, 2022
commit 492ec38707e3019ffa4b06e0287ade842e83565d
20 changes: 9 additions & 11 deletions coderd/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,15 @@ func auditSearchQuery(query string) (database.GetAuditLogsOffsetParams, []coders
}
}

var (
filter = database.GetAuditLogsOffsetParams{
ResourceType: resourceTypeFromString(parser.String(searchParams, "", "resource_type")),
ResourceID: parser.UUID(searchParams, uuid.Nil, "resource_id"),
Action: actionFromString(parser.String(searchParams, "", "action")),
Username: parser.String(searchParams, "", "username"),
Email: parser.String(searchParams, "", "email"),
DateFrom: parsedDateFrom,
DateTo: parsedDateTo,
}
)
filter := database.GetAuditLogsOffsetParams{
ResourceType: resourceTypeFromString(parser.String(searchParams, "", "resource_type")),
ResourceID: parser.UUID(searchParams, uuid.Nil, "resource_id"),
Action: actionFromString(parser.String(searchParams, "", "action")),
Username: parser.String(searchParams, "", "username"),
Email: parser.String(searchParams, "", "email"),
DateFrom: parsedDateFrom,
DateTo: parsedDateTo,
}

return filter, parser.Errors
}
Expand Down
8 changes: 4 additions & 4 deletions coderd/database/databasefake/databasefake.go
Original file line number Diff line number Diff line change
Expand Up @@ -2995,12 +2995,12 @@ func (q *fakeQuerier) GetAuditLogsOffset(ctx context.Context, arg database.GetAu
continue
}
}
if arg.DateFrom != (time.Time{}) {
if !arg.DateFrom.IsZero() {
if alog.Time.Before(arg.DateFrom) {
continue
}
}
if arg.DateTo != (time.Time{}) {
if !arg.DateTo.IsZero() {
if alog.Time.After(arg.DateTo) {
continue
}
Expand Down Expand Up @@ -3067,12 +3067,12 @@ func (q *fakeQuerier) GetAuditLogCount(_ context.Context, arg database.GetAuditL
continue
}
}
if arg.DateFrom != (time.Time{}) {
if !arg.DateFrom.IsZero() {
if alog.Time.Before(arg.DateFrom) {
continue
}
}
if arg.DateTo != (time.Time{}) {
if !arg.DateTo.IsZero() {
if alog.Time.After(arg.DateTo) {
continue
}
Expand Down