mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-05 16:02:19 +00:00
wip: zen
This commit is contained in:
parent
5345c828ca
commit
7447460b5a
24 changed files with 995 additions and 242 deletions
|
|
@ -21,7 +21,7 @@ export namespace Actor {
|
|||
properties: {
|
||||
userID: string
|
||||
workspaceID: string
|
||||
role: UserRole
|
||||
role: (typeof UserRole)[number]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import { mysqlTable, uniqueIndex, varchar, int, mysqlEnum } from "drizzle-orm/my
|
|||
import { timestamps, utc, workspaceColumns } from "../drizzle/types"
|
||||
import { workspaceIndexes } from "./workspace.sql"
|
||||
|
||||
const UserRole = ["admin", "member"] as const
|
||||
export type UserRole = (typeof UserRole)[number]
|
||||
export const UserRole = ["admin", "member"] as const
|
||||
|
||||
export const UserTable = mysqlTable(
|
||||
"user",
|
||||
|
|
@ -13,9 +12,8 @@ export const UserTable = mysqlTable(
|
|||
email: varchar("email", { length: 255 }).notNull(),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
timeSeen: utc("time_seen"),
|
||||
timeJoined: utc("time_joined"),
|
||||
color: int("color"),
|
||||
role: mysqlEnum("role", ["admin", "member"]).notNull(),
|
||||
role: mysqlEnum("role", UserRole).notNull(),
|
||||
},
|
||||
(table) => [...workspaceIndexes(table), uniqueIndex("user_email").on(table.workspaceID, table.email)],
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ export namespace Workspace {
|
|||
id: Identifier.create("user"),
|
||||
email: account.properties.email,
|
||||
name: "",
|
||||
timeSeen: sql`now()`,
|
||||
role: "admin",
|
||||
timeJoined: sql`now()`,
|
||||
})
|
||||
await tx.insert(BillingTable).values({
|
||||
workspaceID,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue