Skip to content
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

feat: Add project API endpoints #51

Merged
merged 22 commits into from
Jan 24, 2022
Merged

feat: Add project API endpoints #51

merged 22 commits into from
Jan 24, 2022

Conversation

kylecarbs
Copy link
Member

@kylecarbs kylecarbs commented Jan 23, 2022

Closes #36

  • Adds endpoints for creating and listing projects.
  • Adds a middleware for namespacing resource by {organization} with a Chi URL parameter.
  • Adds the paralleltest linter for golangci-lint. It should improve test times!

@bryphe-coder this PR could be decomposed if you feel it's best!

@kylecarbs kylecarbs self-assigned this Jan 23, 2022
@codecov
Copy link

codecov bot commented Jan 23, 2022

Codecov Report

Merging #51 (c974594) into main (52e50fc) will decrease coverage by 2.98%.
The diff coverage is 71.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
- Coverage   74.91%   71.92%   -2.99%     
==========================================
  Files          30       64      +34     
  Lines         291     2711    +2420     
  Branches       30       30              
==========================================
+ Hits          218     1950    +1732     
- Misses         67      592     +525     
- Partials        6      169     +163     
Flag Coverage Δ
unittest-go-macos-latest 67.57% <71.83%> (?)
unittest-go-ubuntu-latest 70.74% <68.98%> (?)
unittest-js 74.91% <ø> (ø)
Impacted Files Coverage Δ
coderd/projects.go 66.88% <66.88%> (ø)
httpmw/organizationparam.go 69.81% <69.81%> (ø)
codersdk/projects.go 74.57% <74.57%> (ø)
httpmw/projectparam.go 76.47% <76.47%> (ø)
coderd/coderd.go 88.88% <100.00%> (ø)
httpmw/userparam.go 76.66% <0.00%> (ø)
site/embed.go 72.31% <0.00%> (ø)
peer/netconn.go 30.00% <0.00%> (ø)
provisioner/terraform/parse.go 70.73% <0.00%> (ø)
provisionersdk/transport.go 72.22% <0.00%> (ø)
... and 25 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 52e50fc...c974594. Read the comment docs.

@kylecarbs kylecarbs marked this pull request as ready for review January 23, 2022 19:41
Comment on lines +50 to +53
r.Route("/projects", func(r chi.Router) {
r.Use(
httpmw.ExtractAPIKey(options.Database, nil),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

🥳 Looks like I won't be needing test data much longer!

}

// ExtractOrganizationParam grabs an organization and user membership from the "organization" URL parameter.
// This middleware requires the API key middleware for authentication.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this comment might be out-of-date?

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
// This middleware requires the API key middleware for authentication.
// This middleware grabs the `:organization` URL parameter and makes it available on the request context

Copy link
Member Author

Choose a reason for hiding this comment

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

Nah, but I can improve the wording here. It requires the API middleware prior for authentication. AKA higher in the HTTP callstack it requires it on the context. I'll fix this!

@bryphe-coder
Copy link
Contributor

@bryphe-coder this PR could be decomposed if you feel it's best!

Thanks for offering, @kylecarbs ! I do usually prefer smaller PRs - but I think for our purpose of scaffolding / getting to black triangle, it's OK to have some big chunks of work to start. Once the big pieces like this are in place - it'll make it easier to be more incremental 👍

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.

This is awesome @kylecarbs - thank you for implementing all this! This is huge for getting to our end-to-end flow. LGTM

@kylecarbs kylecarbs enabled auto-merge (squash) January 24, 2022 16:56
@kylecarbs kylecarbs merged commit a44056c into main Jan 24, 2022
@kylecarbs kylecarbs deleted the projects branch January 24, 2022 17:07
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.

Create Projects API
2 participants