feat: billing portal

This commit is contained in:
Henry
2025-01-03 15:12:31 +00:00
parent 67e714b8b0
commit 3ee0c0039c
14 changed files with 2383 additions and 693 deletions

View File

@@ -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
)
`,
)