feat: Add parameter querying to the API (#143)

This commit is contained in:
Kyle Carberry
2022-02-04 12:11:24 -06:00
committed by GitHub
parent 75468fad48
commit c3bae6704b
7 changed files with 225 additions and 0 deletions
+18
View File
@@ -149,3 +149,21 @@ func (api *api) workspacesByProject(rw http.ResponseWriter, r *http.Request) {
render.Status(r, http.StatusOK)
render.JSON(rw, r, apiWorkspaces)
}
// Creates parameters for a project.
// This should validate the calling user has permissions!
func (api *api) postParametersByProject(rw http.ResponseWriter, r *http.Request) {
project := httpmw.ProjectParam(r)
postParameterValueForScope(rw, r, api.Database, database.ParameterScopeProject, project.ID.String())
}
// Lists parameters for a project.
func (api *api) parametersByProject(rw http.ResponseWriter, r *http.Request) {
project := httpmw.ProjectParam(r)
parametersForScope(rw, r, api.Database, database.GetParameterValuesByScopeParams{
Scope: database.ParameterScopeProject,
ScopeID: project.ID.String(),
})
}