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

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 14:15:39 +02:00
1 parent 9aa4f331bf
commit 30b54e99e7
40 files changed
+1183 -784

No files matched your search

+17 -15
View File
@@ -1,12 +1,13 @@
import { eq } from "drizzle-orm";
import Link from "next/link";
import { notFound } from "next/navigation";
import { getTranslations } from "next-intl/server";
import { Badge } from "@/components/ui/badge";
import { requireModPermission } from "@/lib/admin/guard";
import { db, User } from "@/lib/db";
import { formatDate } from "@/lib/format-date";
import { getAvatarUrl } from "@/lib/imager";
import { PERMS } from "@/lib/permissions";
import { prisma } from "@/lib/prisma";
export default async function ModUserDetailPage({
params,
@@ -19,20 +20,21 @@ export default async function ModUserDetailPage({
const id = Number(rawId);
if (!Number.isFinite(id) || id <= 0) notFound();
const user = await prisma.user.findUnique({
where: { id },
select: {
id: true,
username: true,
rank: true,
online: true,
motto: true,
look: true,
accountCreated: true,
lastLogin: true,
lastOnline: true,
},
});
const [user] = await db
.select({
id: User.id,
username: User.username,
rank: User.rank,
online: User.online,
motto: User.motto,
look: User.look,
accountCreated: User.accountCreated,
lastLogin: User.lastLogin,
lastOnline: User.lastOnline,
})
.from(User)
.where(eq(User.id, id))
.limit(1);
if (!user) notFound();
return (