Use coredata models in log export batch loaders

Drop export-only row types; load Identity, PersonalAPIKey,
and MembershipProfile through the usual slice LoadByIDs helpers.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
Cursor Agent
2026-07-29 21:45:45 +00:00
parent e4d86f0f9e
commit 6cbf16814c
4 changed files with 75 additions and 61 deletions

View File

@@ -270,7 +270,7 @@ func loadAuditLogActorExportInfo(
result := make(map[gid.GID]auditLogActorExportInfo)
var identities coredata.IdentityAuditLogActorRows
var identities coredata.Identities
if err := identities.LoadByIDs(ctx, conn, identityIDs); err != nil {
return nil, fmt.Errorf("cannot load audit log actor identities: %w", err)
}
@@ -282,7 +282,7 @@ func loadAuditLogActorExportInfo(
}
}
var apiKeys coredata.PersonalAPIKeyAuditLogActorRows
var apiKeys coredata.PersonalAPIKeys
if err := apiKeys.LoadByIDs(ctx, conn, apiKeyIDs); err != nil {
return nil, fmt.Errorf("cannot load audit log actor API keys: %w", err)
}
@@ -308,7 +308,7 @@ func loadSCIMProfileExportInfo(
return map[string]scimProfileExportInfo{}, nil
}
var profiles coredata.MembershipProfileByUserNameRows
var profiles coredata.MembershipProfiles
if err := profiles.LoadByOrganizationIDAndUserNames(
ctx,
conn,
@@ -328,7 +328,7 @@ func loadSCIMProfileExportInfo(
key := strings.ToLower(*profile.UserName)
result[key] = scimProfileExportInfo{
email: scimEmailFromUserName(*profile.UserName),
fullName: profile.DisplayName(),
fullName: profileFullName(profile),
}
}
@@ -379,6 +379,14 @@ func scimEmailFromUserName(userName string) string {
return ""
}
func profileFullName(profile *coredata.MembershipProfile) string {
if profile.FormattedName != nil && *profile.FormattedName != "" {
return *profile.FormattedName
}
return profile.FullName
}
func stringPtrValue(value *string) string {
if value == nil {
return ""