refactor: reinstate drizzle

This commit is contained in:
Henry
2025-04-23 13:11:00 +01:00
parent 0c25fe3864
commit c1348cf455
22 changed files with 1964 additions and 879 deletions

View File

@@ -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,