feat: custom workspace slugs

This commit is contained in:
Henry
2025-01-23 22:22:29 +00:00
parent 0bd23d24ac
commit f78dd07c38
14 changed files with 57 additions and 58 deletions

View File

@@ -6,6 +6,7 @@ import { generateUID } from "@kan/utils";
export const create = async (
db: SupabaseClient<Database>,
workspaceInput: {
publicId?: string;
name: string;
slug: string;
createdBy: string;
@@ -14,9 +15,9 @@ export const create = async (
const { data } = await db
.from("workspace")
.insert({
publicId: generateUID(),
publicId: workspaceInput.publicId ?? generateUID(),
name: workspaceInput.name,
slug: workspaceInput.name.toLowerCase(),
slug: workspaceInput.slug,
createdBy: workspaceInput.createdBy,
})
.select(`id, publicId, name, slug, description, plan`)
@@ -30,6 +31,7 @@ export const create = async (
workspaceId: data.id,
createdBy: workspaceInput.createdBy,
role: "admin",
status: "active",
});
const newWorkspace = { ...data };