更新日志展示

This commit is contained in:
2026-07-02 14:23:30 +08:00
parent 39b149b206
commit 12070ff4fd
5 changed files with 64 additions and 1 deletions
+22
View File
@@ -136,6 +136,28 @@ func (s *AdminReadService) UserNameMap(ctx context.Context) (map[string]string,
return out, nil
}
// AccountNameMap builds a token-account id -> display label lookup (account
// email, else display name, else id) used to annotate log rows with which
// provider account fulfilled each generation (event_logs.account_id).
func (s *AdminReadService) AccountNameMap(ctx context.Context) (map[string]string, error) {
accounts, err := s.tokens.List(ctx)
if err != nil {
return nil, err
}
out := make(map[string]string, len(accounts))
for _, a := range accounts {
label := strings.TrimSpace(a.AccountEmail)
if label == "" {
label = strings.TrimSpace(a.AccountDisplayName)
}
if label == "" {
label = a.ID
}
out[a.ID] = label
}
return out, nil
}
func (s *AdminReadService) Stats(ctx context.Context) (map[string]any, error) {
stats, err := s.events.Stats(ctx)
if err != nil {