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

+6 -5
View File
@@ -1,5 +1,6 @@
import { eq } from "drizzle-orm";
import { unstable_cache } from "next/cache";
import { prisma } from "@/lib/prisma";
import { db, UserWatch } from "@/lib/db";
/**
* Returns the set of user IDs that the given staff member has marked as
@@ -12,10 +13,10 @@ export async function getWatchedUserIds(staffId: number): Promise<Set<number>> {
const getCachedWatchedIds = unstable_cache(
async (staffId: number): Promise<number[]> => {
const rows = await prisma.userWatch.findMany({
where: { staffId },
select: { targetUserId: true },
});
const rows = await db
.select({ targetUserId: UserWatch.targetUserId })
.from(UserWatch)
.where(eq(UserWatch.staffId, staffId));
return rows.map((r) => r.targetUserId);
},
["user-watch-list"],