feat: Refactor API routes to use UUIDs instead of friendly names (#401)

* Add client for agent

* Cleanup code

* Fix linting error

* Rename routes to be simpler

* Rename workspace history to workspace build

* Refactor HTTP middlewares to use UUIDs

* Cleanup routes

* Compiles!

* Fix files and organizations

* Fix querying

* Fix agent lock

* Cleanup database abstraction

* Add parameters

* Fix linting errors

* Fix log race

* Lock on close wait

* Fix log cleanup

* Fix e2e tests

* Fix upstream version of opencensus-go

* Update coderdtest.go

* Fix coverpkg

* Fix codecov ignore
This commit is contained in:
Kyle Carberry
2022-03-07 11:40:54 -06:00
committed by GitHub
parent 330686f60a
commit bf0ae8f573
115 changed files with 5849 additions and 4653 deletions
+2 -2
View File
@@ -108,7 +108,7 @@ export namespace Workspace {
}
export const login = async (email: string, password: string): Promise<LoginResponse> => {
const response = await fetch("/api/v2/login", {
const response = await fetch("/api/v2/users/login", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -128,7 +128,7 @@ export const login = async (email: string, password: string): Promise<LoginRespo
}
export const logout = async (): Promise<void> => {
const response = await fetch("/api/v2/logout", {
const response = await fetch("/api/v2/users/logout", {
method: "POST",
})
+1 -1
View File
@@ -11,7 +11,7 @@ const globalSetup = async (config: FullConfig): Promise<void> => {
})
// Create initial user
await context.post("/api/v2/user", {
await context.post("/api/v2/users/first", {
data: {
email,
username,
+3 -1
View File
@@ -18,8 +18,10 @@ import { CodeExample } from "../../components/CodeExample/CodeExample"
const ProjectsPage: React.FC = () => {
const styles = useStyles()
const { me, signOut } = useUser(true)
const { data: projects, error } = useSWR<Project[] | null, Error>("/api/v2/projects")
const { data: orgs, error: orgsError } = useSWR<Organization[], Error>("/api/v2/users/me/organizations")
const { data: projects, error } = useSWR<Project[] | null, Error>(
orgs ? `/api/v2/organizations/${orgs[0].id}/projects` : null,
)
if (error) {
return <ErrorSummary error={error} />