feat: update board name

This commit is contained in:
Henry
2023-11-28 23:15:39 +00:00
parent 143245eaf8
commit e1e0ea1615
3 changed files with 67 additions and 21 deletions

View File

@@ -74,4 +74,17 @@ export const boardRouter = createTRPCRouter({
createdBy: userId,
});
}),
update: publicProcedure
.input(
z.object({
boardId: z.string().min(12),
name: z.string().min(1),
}))
.mutation(({ ctx, input }) => {
const userId = ctx.session?.user.id;
if (!userId) return;
return ctx.db.update(boards).set({ name: input.name }).where(eq(boards.publicId, input.boardId));
}),
});