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

refactor: Move all HTTP routes to top-level struct #130

Merged
merged 3 commits into from
Feb 1, 2022
Merged

refactor: Move all HTTP routes to top-level struct #130

merged 3 commits into from
Feb 1, 2022

Conversation

kylecarbs
Copy link
Member

Nesting all structs behind their respective structures
is leaky, and promotes naming conflicts between handlers.

Our HTTP routes cannot have conflicts, so neither should
function naming.

These will be used for streaming logs, checking status,
and other operations related to workspace and project
history.
@kylecarbs kylecarbs self-assigned this Feb 1, 2022
@codecov
Copy link

codecov bot commented Feb 1, 2022

Codecov Report

Merging #130 (ceaba82) into main (c5f1a37) will increase coverage by 4.42%.
The diff coverage is 70.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #130      +/-   ##
==========================================
+ Coverage   64.62%   69.05%   +4.42%     
==========================================
  Files          57      100      +43     
  Lines         636     4317    +3681     
  Branches       68       68              
==========================================
+ Hits          411     2981    +2570     
- Misses        213     1074     +861     
- Partials       12      262     +250     
Flag Coverage Δ
unittest-go-ubuntu-latest 69.81% <70.03%> (?)
unittest-js 64.62% <ø> (ø)
Impacted Files Coverage Δ
coderd/workspacehistory.go 53.71% <53.71%> (ø)
coderd/projecthistory.go 70.14% <70.14%> (ø)
coderd/projects.go 55.55% <95.23%> (ø)
coderd/coderd.go 91.80% <100.00%> (ø)
coderd/users.go 61.63% <100.00%> (ø)
coderd/workspaces.go 67.76% <100.00%> (ø)
codersdk/projects.go 74.57% <100.00%> (ø)
provisioner/terraform/parse.go 78.18% <0.00%> (ø)
httpmw/workspaceparam.go 76.47% <0.00%> (ø)
... and 38 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 c5f1a37...ceaba82. Read the comment docs.

Nesting all structs behind their respective structures
is leaky, and promotes naming conflicts between handlers.

Our HTTP routes cannot have conflicts, so neither should
function naming.
@@ -22,5 +22,6 @@
"cmd": "make gen"
}
]
}
},
"cSpell.words": ["coderd", "coderdtest", "codersdk", "httpmw", "oneof", "stretchr", "xerrors"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding these!


// WorkspaceHistory is an at-point representation of a workspace state.
// Iterate on before/after to determine a chronological history.
type WorkspaceHistory struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for splitting out the project/workspace history

Database: options.Database,
Pubsub: options.Pubsub,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess these were all essentially the same anyway - good call factoring to api

Base automatically changed from parammw to main February 1, 2022 22:10
@kylecarbs kylecarbs enabled auto-merge (squash) February 1, 2022 22:15
@kylecarbs kylecarbs merged commit 177eba8 into main Feb 1, 2022
@kylecarbs kylecarbs deleted the http branch February 1, 2022 22:15
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.

None yet

2 participants