Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add organization_ids in the user(s) response#1184

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 8 commits intomainfrombq/add-org-id-to-the-user-response
Apr 28, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

Reason:
FE needs to access the user org id to perform some actions like creating a new user in the same org. You can see the full conversation herehttps://codercom.slack.com/archives/C01A9SEKFEE/p1650907824531999.

Possible solutions

  • Make it on the endpoint side doing extra database requests
  • Update the user queries to return theorganization_ids directly

@BrunoQuaresmaBrunoQuaresma requested a review froma teamApril 26, 2022 17:11
@BrunoQuaresmaBrunoQuaresma self-assigned thisApr 26, 2022
@BrunoQuaresmaBrunoQuaresma requested a review froma team as acode ownerApril 26, 2022 17:13
@codecov
Copy link

codecovbot commentedApr 26, 2022
edited
Loading

Codecov Report

Merging#1184 (e088a0e) intomain (8661f92) willdecrease coverage by0.25%.
The diff coverage is51.16%.

@@            Coverage Diff             @@##             main    #1184      +/-   ##==========================================- Coverage   66.27%   66.01%   -0.26%==========================================  Files         265      265                Lines       16681    16751      +70       Branches      157      157              ==========================================+ Hits        11055    11059       +4- Misses       4484     4532      +48- Partials     1142     1160      +18
FlagCoverage Δ
unittest-go-macos-latest53.54% <41.86%> (-0.01%)⬇️
unittest-go-postgres-65.32% <47.67%> (-0.18%)⬇️
unittest-go-ubuntu-latest55.96% <41.86%> (-0.18%)⬇️
unittest-go-windows-202252.97% <41.86%> (-0.16%)⬇️
unittest-js66.50% <ø> (ø)
Impacted FilesCoverage Δ
codersdk/users.go64.20% <ø> (ø)
coderd/database/queries.sql.go81.12% <40.00%> (-0.54%)⬇️
coderd/users.go61.27% <54.54%> (-2.01%)⬇️
cli/cliui/agent.go77.19% <0.00%> (-5.27%)⬇️
provisioner/echo/serve.go54.40% <0.00%> (-4.81%)⬇️
peerbroker/proxy.go58.13% <0.00%> (-4.07%)⬇️
provisionerd/provisionerd.go76.84% <0.00%> (-1.34%)⬇️
coderd/provisionerdaemons.go62.79% <0.00%> (-0.51%)⬇️
provisioner/terraform/provision.go70.96% <0.00%> (-0.44%)⬇️
... and1 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update8661f92...e088a0e. Read thecomment docs.

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

We should probably cover the case of fetching multiple users before merging this. Otherwise we'll have a struct that our API only serves onsome routes.

@BrunoQuaresma
Copy link
CollaboratorAuthor

@kylecarbs this PR is covering the scenario of fetching multiple users.https://github.com/coder/coder/pull/1184/files#diff-b4e10e23e473674139719f634b3ad7e760467574e342916c4bbb42df7a613722R151 this is the GET /users endpoint. Or are you talking about something different?

Copy link
Member

@kylecarbskylecarbs left a comment

Choose a reason for hiding this comment

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

LGTM. I'm happy this just adds a single database call!


-- name: GetOrganizationIDsByMemberIDs :many
SELECT
user_id, array_agg(organization_id) :: uuid [ ] AS "organization_IDs"
Copy link
Member

Choose a reason for hiding this comment

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

Can we removeAS "organization_IDs"?

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Unfortunately not because sqlc is generating the field name as "organization_ids" not forcing the "ID" uppercase stuff 😕

@BrunoQuaresmaBrunoQuaresma merged commit816441e intomainApr 28, 2022
@BrunoQuaresmaBrunoQuaresma deleted the bq/add-org-id-to-the-user-response branchApril 28, 2022 14:10
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@presleyppresleyppresleyp left review comments

@kylecarbskylecarbskylecarbs approved these changes

@EmyrkEmyrkAwaiting requested review from Emyrk

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

5 participants
@BrunoQuaresma@presleyp@Emyrk@kylecarbs@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp