Skip to content

chore: merge organization member db queries #13542

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

Merged
merged 4 commits into from
Jun 12, 2024
Merged

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 11, 2024

Merge into 1 that also joins in the user table for username.
Required to list organization members on UI/cli

Copy link
Member Author

Emyrk commented Jun 11, 2024

@Emyrk Emyrk force-pushed the stevenmasley/org_member_db branch from c739650 to b8eb28a Compare June 11, 2024 15:04
Merge into 1 that also joins in the user table for username.
Required to list organization members on UI/cli
@Emyrk Emyrk force-pushed the stevenmasley/org_member_db branch from b8eb28a to 4e1d469 Compare June 11, 2024 15:16
@Emyrk Emyrk force-pushed the stevenmasley/org_member_db branch 2 times, most recently from e2b5ca2 to 13ed01d Compare June 11, 2024 17:01
@Emyrk Emyrk marked this pull request as ready for review June 11, 2024 17:25
@Emyrk Emyrk force-pushed the stevenmasley/org_member_db branch from 13ed01d to e2b5ca2 Compare June 11, 2024 20:26
@Emyrk Emyrk force-pushed the stevenmasley/org_member_db branch from e2b5ca2 to 8b1bc7f Compare June 11, 2024 20:57
Comment on lines -1479 to -1485
func (q *querier) GetOrganizationMemberByUserID(ctx context.Context, arg database.GetOrganizationMemberByUserIDParams) (database.OrganizationMember, error) {
return fetch(q.log, q.auth, q.db.GetOrganizationMemberByUserID)(ctx, arg)
}

func (q *querier) GetOrganizationMembershipsByUserID(ctx context.Context, userID uuid.UUID) ([]database.OrganizationMember, error) {
return fetchWithPostFilter(q.auth, policy.ActionRead, q.db.GetOrganizationMembershipsByUserID)(ctx, userID)
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these, replaced with 1 OrganizationMembers.

Comment on lines +320 to +326

// Optional override of the default error checks.
// By default, we search for the expected error strings.
// If these strings are present, these strings will be searched
// instead.
notAuthorizedExpect string
cancelledCtxExpect string
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to be done with a static list:

slice.Contains([]string{
"GetAuthorizedWorkspaces",
"GetAuthorizedTemplates",
}, methodName) {

We should move to this new approach, which is much closer to the actual writing of the tests.

AND user_id = $2
LIMIT
1;
true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my understanding, why do we need to do where true and case instead of a where case?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, we don't need the true and 👍

@Emyrk Emyrk force-pushed the stevenmasley/org_member_db branch from b98d06b to 2542dcd Compare June 12, 2024 18:38
@Emyrk Emyrk merged commit de9e688 into main Jun 12, 2024
27 checks passed
@Emyrk Emyrk deleted the stevenmasley/org_member_db branch June 12, 2024 19:23
@github-actions github-actions bot locked and limited conversation to collaborators Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants