fix: swich from insertId to returning

This commit is contained in:
Henry
2024-03-28 09:23:11 +00:00
parent f1e705e9ae
commit 0b51d857a9
4 changed files with 38 additions and 22 deletions

View File

@@ -43,11 +43,15 @@ export const labelRouter = createTRPCRouter({
colourCode: input.colourCode,
createdBy: userId,
boardId: card.list.boardId,
});
}).returning({ id: labels.id });
const newLabelId = newLabel[0]?.id
if (!newLabelId) return;
return tx.insert(cardsToLabels).values({
cardId: card.id,
labelId: Number(newLabel.insertId),
labelId: newLabelId,
});
})
}),