refactor(db): finish Drizzle migration for remaining actions and services

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 13:27:59 +02:00
1 parent 22234fe102
commit 65b2fbee6a
19 files changed
+422 -342

No files matched your search

+12 -5
View File
@@ -1,6 +1,7 @@
import "server-only";
import { prisma } from "@/lib/prisma";
import { count, eq, ne } from "drizzle-orm";
import { db, WebsiteHelpCenterTickets, WebsiteTicket } from "@/lib/db";
/** Open-queue sizes for dual ticket products (CMS desk vs help-center). */
export async function fetchTicketQueueOpenCounts(): Promise<{
@@ -8,11 +9,17 @@ export async function fetchTicketQueueOpenCounts(): Promise<{
helpOpen: number;
}> {
const [cmsOpen, helpOpen] = await Promise.all([
prisma.websiteTicket
.count({ where: { status: { not: "closed" } } })
db
.select({ total: count() })
.from(WebsiteTicket)
.where(ne(WebsiteTicket.status, "closed"))
.then((rows) => rows[0]?.total ?? 0)
.catch(() => 0),
prisma.websiteHelpCenterTickets
.count({ where: { open: true } })
db
.select({ total: count() })
.from(WebsiteHelpCenterTickets)
.where(eq(WebsiteHelpCenterTickets.open, true))
.then((rows) => rows[0]?.total ?? 0)
.catch(() => 0),
]);
return { cmsOpen, helpOpen };