diff --git a/lib/db/board.ts b/lib/db/board.ts index 5b8e046..75f8931 100644 --- a/lib/db/board.ts +++ b/lib/db/board.ts @@ -4,6 +4,7 @@ import { eq } from "drizzle-orm"; import { db } from "./client"; import { addMember, checkMemberRole } from "./member"; import { findUserIdByKindeID } from "./user"; +import { nanoid } from "nanoid"; export async function fetchBoards(userId: string, useKindeId: boolean = true) { if (userId === null) { @@ -57,6 +58,7 @@ export async function createBoard(newBoard: Board, kindeId: string) { .execute(); if (board.length > 0) { await addMember({ + id: nanoid(), userId: userId, boardId: board[0].id, role: Role.owner, diff --git a/lib/db/member.ts b/lib/db/member.ts index 596b01d..cc653e5 100644 --- a/lib/db/member.ts +++ b/lib/db/member.ts @@ -5,6 +5,7 @@ import { and, eq } from "drizzle-orm"; export const addMember = async (newMember: NewMember) => { await db.insert(memberTable).values({ + id: newMember.id, userId: newMember.userId, boardId: newMember.boardId, role: newMember.role,