Skip to content

Commit 14ea9cb

Browse files
committed
fix: add extra checks for board and column where needed
1 parent 583cc6f commit 14ea9cb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

app/routes/api/card.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cardRouter.post(
2323
if (!isCurrentColumn) return next(NotFound('Column not found'))
2424

2525
const lastCard = await prisma.card.findFirst({
26-
where: { columnId: params.columnId },
26+
where: { columnId: isCurrentColumn.id },
2727
orderBy: { order: 'desc' },
2828
select: { order: true }
2929
})
@@ -66,7 +66,7 @@ cardRouter.patch(
6666
const transaction = body.ids.map((id, order) =>
6767
prisma.card.update({
6868
where: { id },
69-
data: { order, columnId: params.columnId }
69+
data: { order, columnId: column.id }
7070
})
7171
)
7272

app/routes/api/column.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ columnRouter.post(
2626
if (!board) return next(NotFound('Board not found'))
2727

2828
const lastColumn = await prisma.column.findFirst({
29-
where: { boardId: params.boardId },
29+
where: { boardId: board.id },
3030
orderBy: { order: 'desc' },
3131
select: { order: true }
3232
})
@@ -69,7 +69,7 @@ columnRouter.patch(
6969
const transaction = body.ids.map((id, order) =>
7070
prisma.column.update({
7171
where: { id },
72-
data: { order, boardId: params.boardId }
72+
data: { order, boardId: board.id }
7373
})
7474
)
7575

0 commit comments

Comments
 (0)