feat: workspace description
This commit is contained in:
@@ -96,6 +96,7 @@ export const memberRouter = createTRPCRouter({
|
||||
const newUser = await userRepo.create(ctx.adminDb, {
|
||||
email: invitedUserEmail,
|
||||
id: invitedUserAuthId,
|
||||
stripeCustomerId: "",
|
||||
});
|
||||
|
||||
invitedUserId = newUser?.id;
|
||||
|
||||
@@ -145,6 +145,7 @@ export const workspaceRouter = createTRPCRouter({
|
||||
workspacePublicId: z.string().min(12),
|
||||
name: z.string().min(3).max(24).optional(),
|
||||
slug: z.string().min(3).max(24).optional(),
|
||||
description: z.string().min(3).max(280).optional(),
|
||||
}),
|
||||
)
|
||||
.output(z.custom<Awaited<ReturnType<typeof workspaceRepo.update>>>())
|
||||
@@ -177,8 +178,11 @@ export const workspaceRouter = createTRPCRouter({
|
||||
const result = await workspaceRepo.update(
|
||||
ctx.db,
|
||||
input.workspacePublicId,
|
||||
input.name,
|
||||
input.slug,
|
||||
{
|
||||
name: input.name,
|
||||
slug: input.slug,
|
||||
description: input.description,
|
||||
},
|
||||
);
|
||||
|
||||
return result;
|
||||
|
||||
1
packages/db/migrations/0003_fine_bedlam.sql
Normal file
1
packages/db/migrations/0003_fine_bedlam.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE "workspace" ADD COLUMN "description" text;
|
||||
1514
packages/db/migrations/meta/0003_snapshot.json
Normal file
1514
packages/db/migrations/meta/0003_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,13 @@
|
||||
"when": 1735904544867,
|
||||
"tag": "0002_bored_retro_girl",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "7",
|
||||
"when": 1736084845433,
|
||||
"tag": "0003_fine_bedlam",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -42,13 +42,21 @@ export const create = async (
|
||||
export const update = async (
|
||||
db: SupabaseClient<Database>,
|
||||
workspacePublicId: string,
|
||||
name: string | undefined,
|
||||
slug: string | undefined,
|
||||
plan?: "free" | "pro" | "enterprise",
|
||||
workspaceInput: {
|
||||
name?: string;
|
||||
slug?: string;
|
||||
plan?: "free" | "pro" | "enterprise";
|
||||
description?: string;
|
||||
},
|
||||
) => {
|
||||
const { data } = await db
|
||||
.from("workspace")
|
||||
.update({ name, slug, plan })
|
||||
.update({
|
||||
name: workspaceInput.name,
|
||||
slug: workspaceInput.slug,
|
||||
plan: workspaceInput.plan,
|
||||
description: workspaceInput.description,
|
||||
})
|
||||
.eq("publicId", workspacePublicId)
|
||||
.is("deletedAt", null);
|
||||
|
||||
@@ -111,6 +119,7 @@ export const getBySlugWithBoards = async (
|
||||
`
|
||||
publicId,
|
||||
name,
|
||||
description,
|
||||
slug,
|
||||
boards: board (
|
||||
publicId,
|
||||
@@ -139,6 +148,7 @@ export const getAllByUserId = async (
|
||||
workspace (
|
||||
publicId,
|
||||
name,
|
||||
description,
|
||||
slug,
|
||||
plan
|
||||
)
|
||||
|
||||
@@ -293,6 +293,7 @@ export const workspaces = pgTable("workspace", {
|
||||
id: bigserial("id", { mode: "number" }).primaryKey(),
|
||||
publicId: varchar("publicId", { length: 12 }).notNull().unique(),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
description: text("description"),
|
||||
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
||||
plan: workspacePlanEnum("plan").notNull().default("free"),
|
||||
createdBy: uuid("createdBy")
|
||||
|
||||
@@ -582,6 +582,7 @@ export type Database = {
|
||||
createdBy: string
|
||||
deletedAt: string | null
|
||||
deletedBy: string | null
|
||||
description: string | null
|
||||
id: number
|
||||
name: string
|
||||
plan: Database["public"]["Enums"]["workspace_plan"]
|
||||
@@ -594,6 +595,7 @@ export type Database = {
|
||||
createdBy: string
|
||||
deletedAt?: string | null
|
||||
deletedBy?: string | null
|
||||
description?: string | null
|
||||
id?: number
|
||||
name: string
|
||||
plan?: Database["public"]["Enums"]["workspace_plan"]
|
||||
@@ -606,6 +608,7 @@ export type Database = {
|
||||
createdBy?: string
|
||||
deletedAt?: string | null
|
||||
deletedBy?: string | null
|
||||
description?: string | null
|
||||
id?: number
|
||||
name?: string
|
||||
plan?: Database["public"]["Enums"]["workspace_plan"]
|
||||
|
||||
Reference in New Issue
Block a user