mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 01:34:22 +01:00
wip: zen
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user