Skip to content

Commit

Permalink
fix: Add member missing id
Browse files Browse the repository at this point in the history
  • Loading branch information
DW225 committed Sep 23, 2024
1 parent cc31a9b commit 7c7a385
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/db/board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/db/member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7c7a385

Please sign in to comment.