-
Notifications
You must be signed in to change notification settings - Fork 887
feat: show organization name for groups on user profile #14448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use sqlc.embed
, and another idea is to rope GetGroupByID
and GetGroupsByOrgAndName
into the GetGroups
query.
It feels weird, but it guarantees 1 fetch
query on the backend, and therefore 1 group type
.
I did this with OrganizationMembers
and use a wrapper func to convert the :Many
to :One
query:
coder/coderd/httpmw/organizationparam.go
Lines 123 to 126 in e000bd1
organizationMember, err := database.ExpectOne(db.OrganizationMembers(ctx, database.OrganizationMembersParams{ | |
OrganizationID: organization.ID, | |
UserID: user.ID, | |
})) |
The alternative is making a view, but those are kinda a pain to maintain with migrations. I'll let you make that call based on where the types are used. It is just annoying to have database.GetGroupRow
and database.Group
types in the BE sometimes.
I am not against this, but it sounds like it might be a little out of my comfort zone, and probably big enough for a PR of its own |
Definitely agree. This is one of the reasons row-typing can be really nice on the backend, but we're not replacing Go anytime soon. :p |
Closes #14213
Show the organization the group is from on the user profile page for multi-org deployments