mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
chore: add sql filter to fetching audit logs (#14070)
* chore: add sql filter to fetching audit logs * use sqlc.embed for audit logs * fix sql query matcher
This commit is contained in:
@ -40,10 +40,11 @@ var genCtx = dbauthz.As(context.Background(), rbac.Subject{
|
||||
|
||||
func AuditLog(t testing.TB, db database.Store, seed database.AuditLog) database.AuditLog {
|
||||
log, err := db.InsertAuditLog(genCtx, database.InsertAuditLogParams{
|
||||
ID: takeFirst(seed.ID, uuid.New()),
|
||||
Time: takeFirst(seed.Time, dbtime.Now()),
|
||||
UserID: takeFirst(seed.UserID, uuid.New()),
|
||||
OrganizationID: takeFirst(seed.OrganizationID, uuid.New()),
|
||||
ID: takeFirst(seed.ID, uuid.New()),
|
||||
Time: takeFirst(seed.Time, dbtime.Now()),
|
||||
UserID: takeFirst(seed.UserID, uuid.New()),
|
||||
// Default to the nil uuid. So by default audit logs are not org scoped.
|
||||
OrganizationID: takeFirst(seed.OrganizationID),
|
||||
Ip: pqtype.Inet{
|
||||
IPNet: takeFirstIP(seed.Ip.IPNet, net.IPNet{}),
|
||||
Valid: takeFirst(seed.Ip.Valid, false),
|
||||
|
Reference in New Issue
Block a user