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

+13 -12
View File
@@ -1,3 +1,4 @@
import { desc } from "drizzle-orm";
import Image from "next/image";
import Link from "next/link";
import { getTranslations } from "next-intl/server";
@@ -7,8 +8,8 @@ import {
OnlineBadge,
RankBadge,
} from "@/components/public/ui";
import { db, User } from "@/lib/db";
import { avatarImageUrl } from "@/lib/format";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
export const revalidate = 300;
@@ -27,17 +28,17 @@ export default async function RankingsPage() {
const t = await getTranslations("pages.rankings");
let users: TopUser[] = [];
try {
users = await prisma.user.findMany({
select: {
username: true,
look: true,
credits: true,
rank: true,
online: true,
},
orderBy: { credits: "desc" },
take: 12,
});
users = await db
.select({
username: User.username,
look: User.look,
credits: User.credits,
rank: User.rank,
online: User.online,
})
.from(User)
.orderBy(desc(User.credits))
.limit(12);
} catch {
users = [];
}