This commit is contained in:
Frank
2025-10-03 23:48:29 -04:00
parent 477586835a
commit a11a608760
9 changed files with 1488 additions and 32 deletions

View File

@@ -12,13 +12,14 @@ export namespace Workspace {
export const create = fn(z.void(), async () => {
const account = Actor.assert("account")
const workspaceID = Identifier.create("workspace")
const userID = Identifier.create("user")
await Database.transaction(async (tx) => {
await tx.insert(WorkspaceTable).values({
id: workspaceID,
})
await tx.insert(UserTable).values({
workspaceID,
id: Identifier.create("user"),
id: userID,
accountID: account.properties.accountID,
name: "",
role: "admin",
@@ -30,9 +31,10 @@ export namespace Workspace {
})
})
await Actor.provide(
"system",
"user",
{
workspaceID,
userID,
},
() => Key.create({ name: "Default API Key" }),
)