@@ -2609,6 +2609,10 @@ func (q *FakeQuerier) GetGroupMembersCountByGroupID(ctx context.Context, groupID
2609
2609
return int64 (len (users )), nil
2610
2610
}
2611
2611
2612
+ type GetGroupsCachedOrganizationDetails struct {
2613
+ name , displayName string
2614
+ }
2615
+
2612
2616
func (q * FakeQuerier ) GetGroups (_ context.Context , arg database.GetGroupsParams ) ([]database.GetGroupsRow , error ) {
2613
2617
err := validateDatabaseType (arg )
2614
2618
if err != nil {
@@ -2634,7 +2638,7 @@ func (q *FakeQuerier) GetGroups(_ context.Context, arg database.GetGroupsParams)
2634
2638
}
2635
2639
}
2636
2640
2637
- organizationDisplayNames := make (map [uuid.UUID ]string )
2641
+ organizationDisplayNames := make (map [uuid.UUID ]struct { name , displayName string } )
2638
2642
filtered := make ([]database.GetGroupsRow , 0 )
2639
2643
for _ , group := range q .groups {
2640
2644
if arg .OrganizationID != uuid .Nil && group .OrganizationID != arg .OrganizationID {
@@ -2646,20 +2650,23 @@ func (q *FakeQuerier) GetGroups(_ context.Context, arg database.GetGroupsParams)
2646
2650
continue
2647
2651
}
2648
2652
2649
- orgDisplayName , ok := organizationDisplayNames [group .ID ]
2653
+ orgDetails , ok := organizationDisplayNames [group .ID ]
2650
2654
if ! ok {
2651
2655
for _ , org := range q .organizations {
2652
2656
if group .OrganizationID == org .ID {
2653
- orgDisplayName = org .DisplayName
2657
+ orgDetails = struct { name , displayName string }{
2658
+ name : org .Name , displayName : org .DisplayName ,
2659
+ }
2654
2660
break
2655
2661
}
2656
2662
}
2657
- organizationDisplayNames [group .ID ] = orgDisplayName
2663
+ organizationDisplayNames [group .ID ] = orgDetails
2658
2664
}
2659
2665
2660
2666
filtered = append (filtered , database.GetGroupsRow {
2661
2667
Group : group ,
2662
- OrganizationDisplayName : orgDisplayName ,
2668
+ OrganizationName : orgDetails .name ,
2669
+ OrganizationDisplayName : orgDetails .displayName ,
2663
2670
})
2664
2671
}
2665
2672
0 commit comments