Skip to content

feat: Add organizations endpoint for users #50

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 9 commits into from
Jan 23, 2022
Merged

feat: Add organizations endpoint for users #50

merged 9 commits into from
Jan 23, 2022

Conversation

kylecarbs
Copy link
Member

This moves the /user endpoint to /users/me instead. This
will reduce code duplication.

This adds /users//organizations to list organizations
a user has access to. It doesn't contain the permissions a
user has over the organizations, but that will come in a future
contribution.

This moves the /user endpoint to /users/me instead. This
will reduce code duplication.

This adds /users/<name>/organizations to list organizations
a user has access to. It doesn't contain the permissions a
user has over the organizations, but that will come in a future
contribution.
@kylecarbs kylecarbs self-assigned this Jan 22, 2022
@codecov
Copy link

codecov bot commented Jan 22, 2022

Codecov Report

Merging #50 (41ec8ba) into main (50d8151) will increase coverage by 0.23%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #50      +/-   ##
==========================================
+ Coverage   71.25%   71.48%   +0.23%     
==========================================
  Files          59       60       +1     
  Lines        2327     2395      +68     
  Branches       30       30              
==========================================
+ Hits         1658     1712      +54     
- Misses        523      532       +9     
- Partials      146      151       +5     
Flag Coverage Δ
unittest-go-macos-latest 66.27% <79.74%> (+0.04%) ⬆️
unittest-go-ubuntu-latest 70.05% <79.74%> (-0.23%) ⬇️
unittest-go-windows-latest 65.76% <79.74%> (+0.01%) ⬆️
unittest-js 74.91% <100.00%> (ø)
Impacted Files Coverage Δ
codersdk/users.go 55.55% <70.00%> (+4.20%) ⬆️
coderd/users.go 60.91% <70.37%> (+1.33%) ⬆️
httpmw/userparam.go 76.66% <76.66%> (ø)
coderd/coderd.go 80.76% <100.00%> (+1.60%) ⬆️
coderd/coderdtest/coderdtest.go 100.00% <100.00%> (ø)
coderd/organizations.go 100.00% <100.00%> (ø)
site/components/SignIn/SignInForm.tsx 100.00% <100.00%> (ø)
site/contexts/UserContext.tsx 93.33% <100.00%> (ø)
codersdk/client.go 55.73% <0.00%> (-6.56%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50d8151...41ec8ba. Read the comment docs.

UpdatedAt time.Time `json:"updated_at" validate:"required"`
}

// convertOrganization consumes the database representation and outputs API friendly.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// convertOrganization consumes the database representation and outputs API friendly.
// convertOrganization consumes the database representation and outputs an API friendly representation.

Copy link
Contributor

@bryphe-coder bryphe-coder left a comment

Choose a reason for hiding this comment

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

Just some minor nits - but overall looks good!

One thing I'm wondering about (that doesn't have to block this PR) - is if Organizations is a feature that isn't part of open-core, maybe we'll eventually have to move these endpoints to the closed/enterprise offering? (whether its through the plugin @ketang is exploring, or another strategy - like the augmentation approach we use to host v2 APIs in v1).

@kylecarbs kylecarbs merged commit 8be2456 into main Jan 23, 2022
@kylecarbs kylecarbs deleted the userorgs branch January 23, 2022 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants