Skip to content

Commit

Permalink
fix: /workspaces/create: rename workspace name param (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-balitskyi committed Mar 29, 2024
1 parent 7fa6a00 commit 587dab5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/pages/api/workspaces/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ import { jsonBody } from "pages/api/internal/workspaces/create.ts"
export const route_spec = {
methods: ["POST"],
auth: "access_token",
jsonBody,
jsonBody: jsonBody
.omit({ workspace_name: true })
.extend({ name: z.string() }),
jsonResponse: z.object({
workspace,
}),
} as const

export default withRouteSpec(route_spec)(async (req, res) => {
const { workspace_name, connect_partner_name, is_sandbox } = req.body
const { name, connect_partner_name, is_sandbox } = req.body

const workspace = req.db.addWorkspace({
name: workspace_name,
name,
connect_partner_name,
is_sandbox,
})
Expand Down
2 changes: 1 addition & 1 deletion src/route-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4998,11 +4998,11 @@ export type Routes = {
method: "POST"
queryParams: {}
jsonBody: {
workspace_name: string
connect_partner_name: string
is_sandbox: boolean
webview_primary_button_color?: string | undefined
webview_logo_shape?: ("circle" | "square") | undefined
name: string
}
commonParams: {}
formData: {}
Expand Down
2 changes: 1 addition & 1 deletion test/api/workspaces/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test("POST /workspaces/create", async (t: ExecutionContext) => {
{
connect_partner_name: "Test",
is_sandbox: true,
workspace_name: "Test",
name: "Test",
},
{
headers: {
Expand Down

0 comments on commit 587dab5

Please sign in to comment.