feat: Add APIs for querying workspaces (#61)

* Add SQL migration

* Add query functions for workspaces

* Add create routes

* Add tests for codersdk

* Add workspace parameter route

* Add workspace query

* Move workspace function

* Add querying for workspace history

* Fix query

* Fix syntax error

* Move workspace routes

* Fix version

* Add CLI tests

* Fix syntax error

* Remove error

* Fix history error

* Add new user test

* Fix test

* Lower target to 70%

* Improve comments

* Add comment
This commit is contained in:
Kyle Carberry
2022-01-25 19:52:58 +00:00
committed by GitHub
parent 139828d594
commit 5b01f615eb
27 changed files with 2511 additions and 81 deletions
+2 -2
View File
@@ -33,13 +33,13 @@ func ExtractUserParam(db database.Store) func(http.Handler) http.Handler {
})
return
}
if userID != "me" {
apiKey := APIKey(r)
if apiKey.UserID != userID && userID != "me" {
httpapi.Write(rw, http.StatusBadRequest, httpapi.Response{
Message: "getting non-personal users isn't supported yet",
})
return
}
apiKey := APIKey(r)
user, err := db.GetUserByID(r.Context(), apiKey.UserID)
if err != nil {
httpapi.Write(rw, http.StatusInternalServerError, httpapi.Response{