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

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 14:15:32 +02:00
1 parent 2cd0863cb8
commit 580972c0a0
40 files changed
+1089 -808

No files matched your search

+6 -5
View File
@@ -1,10 +1,11 @@
import { inArray } from "drizzle-orm";
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { saveMaintenance } from "@/actions/admin-maintenance";
import { StatusCard } from "@/components/admin/dashboard";
import { Button } from "@/components/ui/button";
import { db, WebsiteSetting } from "@/lib/db";
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
import { prisma } from "@/lib/prisma";
const KEYS = [
"maintenance_enabled",
@@ -22,10 +23,10 @@ export default async function AdminMaintenance() {
let rows: { key: string; value: string }[] = [];
try {
rows = await prisma.websiteSetting.findMany({
where: { key: { in: [...KEYS] } },
select: { key: true, value: true },
});
rows = await db
.select({ key: WebsiteSetting.key, value: WebsiteSetting.value })
.from(WebsiteSetting)
.where(inArray(WebsiteSetting.key, [...KEYS]));
} catch {
rows = [];
}