Skip to content

Commit d460922

Browse files
committed
get rid of GroupWithOrganizationInfo type
1 parent 4447c81 commit d460922

File tree

13 files changed

+139
-241
lines changed

13 files changed

+139
-241
lines changed

coderd/apidoc/docs.go

Lines changed: 8 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 7 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/db2sdk/db2sdk.go

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -208,26 +208,19 @@ func Users(users []database.User, organizationIDs map[uuid.UUID][]uuid.UUID) []c
208208
})
209209
}
210210

211-
func Group(group database.Group, members []database.GroupMember, totalMemberCount int) codersdk.Group {
211+
func Group(row database.GetGroupsRow, members []database.GroupMember, totalMemberCount int) codersdk.Group {
212212
return codersdk.Group{
213-
ID: group.ID,
214-
Name: group.Name,
215-
DisplayName: group.DisplayName,
216-
OrganizationID: group.OrganizationID,
217-
AvatarURL: group.AvatarURL,
218-
Members: ReducedUsersFromGroupMembers(members),
219-
TotalMemberCount: totalMemberCount,
220-
QuotaAllowance: int(group.QuotaAllowance),
221-
Source: codersdk.GroupSource(group.Source),
222-
}
223-
}
224-
225-
func GroupWithOrganizationInfo(group database.Group, orgName, orgDisplayName string, members []database.GroupMember, totalMemberCount int) codersdk.GroupWithOrganizationInfo {
226-
sdkGroup := Group(group, members, totalMemberCount)
227-
return codersdk.GroupWithOrganizationInfo{
228-
Group: sdkGroup,
229-
OrganizationName: orgName,
230-
OrganizationDisplayName: orgDisplayName,
213+
ID: row.Group.ID,
214+
Name: row.Group.Name,
215+
DisplayName: row.Group.DisplayName,
216+
OrganizationID: row.Group.OrganizationID,
217+
AvatarURL: row.Group.AvatarURL,
218+
Members: ReducedUsersFromGroupMembers(members),
219+
TotalMemberCount: totalMemberCount,
220+
QuotaAllowance: int(row.Group.QuotaAllowance),
221+
Source: codersdk.GroupSource(row.Group.Source),
222+
OrganizationName: row.OrganizationName,
223+
OrganizationDisplayName: row.OrganizationDisplayName,
231224
}
232225
}
233226

codersdk/groups.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,12 @@ type Group struct {
3434
// How many members are in this group. Shows the total count,
3535
// even if the user is not authorized to read group member details.
3636
// May be greater than `len(Group.Members)`.
37-
TotalMemberCount int `json:"total_member_count"`
38-
AvatarURL string `json:"avatar_url"`
39-
QuotaAllowance int `json:"quota_allowance"`
40-
Source GroupSource `json:"source"`
41-
}
42-
43-
type GroupWithOrganizationInfo struct {
44-
Group
45-
OrganizationName string `json:"organization_name"`
46-
OrganizationDisplayName string `json:"organization_display_name"`
37+
TotalMemberCount int `json:"total_member_count"`
38+
AvatarURL string `json:"avatar_url"`
39+
QuotaAllowance int `json:"quota_allowance"`
40+
Source GroupSource `json:"source"`
41+
OrganizationName string `json:"organization_name"`
42+
OrganizationDisplayName string `json:"organization_display_name"`
4743
}
4844

4945
func (g Group) IsEveryone() bool {

0 commit comments

Comments
 (0)