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 APIs for querying workspaces #61

Merged
merged 24 commits into from
Jan 25, 2022
Merged

feat: Add APIs for querying workspaces #61

merged 24 commits into from
Jan 25, 2022

Conversation

kylecarbs
Copy link
Member

@kylecarbs kylecarbs commented Jan 25, 2022

Closes #23

  • Adds an endpoint for creating additional users. This is used to ensure users can't create projects from organizations they aren't in.
  • Adds endpoints for creating workspaces, updating the history, and listing it!

In my next PR I'll be tackling provisionerd, which will process the builds and hopefully link the entire system together!

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

codecov bot commented Jan 25, 2022

Codecov Report

Merging #61 (ee7a994) into main (139828d) will decrease coverage by 0.37%.
The diff coverage is 69.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
- Coverage   71.64%   71.26%   -0.38%     
==========================================
  Files          79       82       +3     
  Lines        2902     3376     +474     
  Branches       49       49              
==========================================
+ Hits         2079     2406     +327     
- Misses        647      766     +119     
- Partials      176      204      +28     
Flag Coverage Δ
unittest-go-macos-latest 67.66% <69.35%> (+0.14%) ⬆️
unittest-go-ubuntu-latest 69.57% <67.58%> (-0.86%) ⬇️
unittest-go-windows-latest 67.30% <69.35%> (-0.01%) ⬇️
unittest-js 73.10% <ø> (ø)
Impacted Files Coverage Δ
codersdk/users.go 55.40% <45.45%> (-1.74%) ⬇️
coderd/users.go 61.63% <61.11%> (-1.61%) ⬇️
coderd/workspaces.go 64.01% <64.01%> (ø)
codersdk/workspaces.go 73.95% <73.95%> (ø)
httpmw/workspaceparam.go 76.47% <76.47%> (ø)
codersdk/projects.go 74.57% <87.50%> (ø)
coderd/coderd.go 92.42% <100.00%> (+3.29%) ⬆️
coderd/projects.go 67.32% <100.00%> (+0.43%) ⬆️
httpmw/projectparam.go 76.47% <100.00%> (ø)
httpmw/userparam.go 76.66% <100.00%> (ø)
... and 2 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 139828d...ee7a994. Read the comment docs.

@kylecarbs kylecarbs marked this pull request as ready for review January 25, 2022 18:42
Comment on lines +40 to +41
ProjectID uuid.UUID `json:"project_id" validate:"required"`
Name string `json:"name" validate:"username,required"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks easy to create!

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.

Overall looks great! Just had a question about the POST /workspaces/{user}/{workspace}/history API

Comment on lines +45 to +48
type CreateWorkspaceHistoryRequest struct {
ProjectHistoryID uuid.UUID `json:"project_history_id" validate:"required"`
Transition database.WorkspaceTransition `json:"transition" validate:"oneof=create start stop delete,required"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand this API - why does it need the ProjectHistoryID? Where would the front-end get this?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we'd use either the ProjectHistoryID the workspace was created with, or the latest one - and in either case, the backend would know that 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh so there's project history and workspace history.

Workspace history tracks project history, so it's needed! The frontend will query the project and probably grab the latest, but I didn't want to make it a requirement.

@kylecarbs kylecarbs enabled auto-merge (squash) January 25, 2022 19:29
@kylecarbs kylecarbs merged commit 5b01f61 into main Jan 25, 2022
@kylecarbs kylecarbs deleted the workspaces branch January 25, 2022 19:52
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.

Implement initial API surface for creating workspace
2 participants