refactor: reinstate drizzle
This commit is contained in:
@@ -57,18 +57,11 @@ export const cardRouter = createTRPCRouter({
|
||||
|
||||
let index = 0;
|
||||
|
||||
if (list.cards.length) {
|
||||
if (input.position === "end" && lastCard) index = lastCard.index + 1;
|
||||
|
||||
if (input.position === "start") {
|
||||
await cardRepo.pushIndex(ctx.db, {
|
||||
listId: list.id,
|
||||
cardIndex: 0,
|
||||
});
|
||||
}
|
||||
if (list.cards.length && input.position === "end" && lastCard) {
|
||||
index = lastCard.index + 1;
|
||||
}
|
||||
|
||||
const newCard = await cardRepo.create(ctx.db, {
|
||||
const newCard = await cardRepo.create(ctx.drizzleDb, {
|
||||
title: input.title,
|
||||
description: input.description,
|
||||
createdBy: userId,
|
||||
@@ -76,7 +69,7 @@ export const cardRouter = createTRPCRouter({
|
||||
index,
|
||||
});
|
||||
|
||||
const newCardId = newCard?.id;
|
||||
const newCardId = newCard.id;
|
||||
|
||||
if (!newCardId)
|
||||
throw new TRPCError({
|
||||
@@ -84,12 +77,6 @@ export const cardRouter = createTRPCRouter({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
});
|
||||
|
||||
await cardActivityRepo.create(ctx.db, {
|
||||
type: "card.created",
|
||||
cardId: newCard.id,
|
||||
createdBy: userId,
|
||||
});
|
||||
|
||||
if (newCardId && input.labelPublicIds.length) {
|
||||
const labels = await labelRepo.getAllByPublicIds(
|
||||
ctx.db,
|
||||
|
||||
Reference in New Issue
Block a user