Skip to content

Commit 9f5f50f

Browse files
committed
refactor: improved tp_index
1 parent d914b4b commit 9f5f50f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tables/audit_log_table.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tables
22

33
import (
4+
"fmt"
45
"time"
56

67
"github.com/rs/xid"
@@ -59,8 +60,12 @@ func (c *AuditLogTable) EnrichRow(row *rows.AuditLog, _ *AuditLogTableConfig, so
5960
row.TpIndex = *row.Org
6061
case row.User != nil:
6162
row.TpIndex = *row.User
62-
default:
63+
case row.OrgID != nil:
6364
row.TpIndex = *row.OrgID
65+
case row.UserID != nil:
66+
row.TpIndex = fmt.Sprintf("%d", *row.UserID)
67+
default:
68+
row.TpIndex = "default"
6469
}
6570
row.TpDate = row.Timestamp.Truncate(24 * time.Hour)
6671
return row, nil

0 commit comments

Comments
 (0)