feat: billing portal
This commit is contained in:
@@ -44,10 +44,11 @@ export const update = async (
|
||||
workspacePublicId: string,
|
||||
name: string | undefined,
|
||||
slug: string | undefined,
|
||||
plan?: "free" | "pro" | "enterprise",
|
||||
) => {
|
||||
const { data } = await db
|
||||
.from("workspace")
|
||||
.update({ name, slug })
|
||||
.update({ name, slug, plan })
|
||||
.eq("publicId", workspacePublicId)
|
||||
.is("deletedAt", null);
|
||||
|
||||
@@ -60,7 +61,7 @@ export const getByPublicId = async (
|
||||
) => {
|
||||
const { data } = await db
|
||||
.from("workspace")
|
||||
.select(`id, publicId, name`)
|
||||
.select(`id, publicId, name, plan`)
|
||||
.is("deletedAt", null)
|
||||
.eq("publicId", workspacePublicId)
|
||||
.limit(1)
|
||||
@@ -112,7 +113,8 @@ export const getAllByUserId = async (
|
||||
workspace (
|
||||
publicId,
|
||||
name,
|
||||
slug
|
||||
slug,
|
||||
plan
|
||||
)
|
||||
`,
|
||||
)
|
||||
|
||||
@@ -40,6 +40,11 @@ export const activityTypeEnum = pgEnum("card_activity_type", [
|
||||
"card.archived",
|
||||
]);
|
||||
export const slugTypeEnum = pgEnum("slug_type", ["reserved", "premium"]);
|
||||
export const workspacePlanEnum = pgEnum("workspace_plan", [
|
||||
"free",
|
||||
"pro",
|
||||
"enterprise",
|
||||
]);
|
||||
|
||||
export const boards = pgTable("board", {
|
||||
id: bigserial("id", { mode: "number" }).primaryKey(),
|
||||
@@ -289,6 +294,7 @@ export const workspaces = pgTable("workspace", {
|
||||
publicId: varchar("publicId", { length: 12 }).notNull().unique(),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
||||
plan: workspacePlanEnum("plan").notNull().default("free"),
|
||||
createdBy: uuid("createdBy")
|
||||
.notNull()
|
||||
.references(() => users.id),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user