refactor(db): migrate app pages and APIs from Prisma facade to Drizzle

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 14:15:12 +02:00
1 parent 53b350057d
commit 7c39aef5d9
40 files changed
+1124 -692

No files matched your search

+25 -18
View File
@@ -1,8 +1,9 @@
import { asc, eq } from "drizzle-orm";
import Link from "next/link";
import { notFound } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { ContentCard, EmptyState } from "@/components/public/ui";
import { prisma } from "@/lib/prisma";
import { db, WebsiteRareValueCategories, WebsiteRareValues } from "@/lib/db";
import { siteSettings } from "@/lib/services/site-settings";
export const revalidate = 300;
@@ -52,10 +53,16 @@ export default async function RareCategoryPage({
let cat: { id: bigint; name: string; badge: string } | null = null;
try {
cat = await prisma.websiteRareValueCategories.findUnique({
where: { id: categoryId },
select: { id: true, name: true, badge: true },
});
const [row] = await db
.select({
id: WebsiteRareValueCategories.id,
name: WebsiteRareValueCategories.name,
badge: WebsiteRareValueCategories.badge,
})
.from(WebsiteRareValueCategories)
.where(eq(WebsiteRareValueCategories.id, categoryId))
.limit(1);
cat = row ?? null;
} catch {
cat = null;
}
@@ -64,19 +71,19 @@ export default async function RareCategoryPage({
let rares: RareRow[] = [];
try {
rares = await prisma.websiteRareValues.findMany({
where: { categoryId: categoryId },
orderBy: { name: "asc" },
select: {
id: true,
name: true,
creditValue: true,
currencyValue: true,
currencyType: true,
furnitureIcon: true,
itemId: true,
},
});
rares = await db
.select({
id: WebsiteRareValues.id,
name: WebsiteRareValues.name,
creditValue: WebsiteRareValues.creditValue,
currencyValue: WebsiteRareValues.currencyValue,
currencyType: WebsiteRareValues.currencyType,
furnitureIcon: WebsiteRareValues.furnitureIcon,
itemId: WebsiteRareValues.itemId,
})
.from(WebsiteRareValues)
.where(eq(WebsiteRareValues.categoryId, categoryId))
.orderBy(asc(WebsiteRareValues.name));
} catch {
rares = [];
}