This commit is contained in:
Frank
2025-10-06 17:13:15 -04:00
parent 9e8fd16e6e
commit c2f57ea74d
4 changed files with 240 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import { UserTable } from "./schema/user.sql"
import { BillingTable } from "./schema/billing.sql"
import { WorkspaceTable } from "./schema/workspace.sql"
import { Key } from "./key"
import { eq } from "drizzle-orm"
export namespace Workspace {
export const create = fn(
@@ -45,4 +46,21 @@ export namespace Workspace {
return workspaceID
},
)
export const update = fn(
z.object({
name: z.string().min(1).max(255),
}),
async ({ name }) => {
const workspaceID = Actor.workspace()
return await Database.use((tx) =>
tx
.update(WorkspaceTable)
.set({
name,
})
.where(eq(WorkspaceTable.id, workspaceID)),
)
},
)
}