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

+13 -12
View File
@@ -1,9 +1,10 @@
import { desc } from "drizzle-orm";
import { getTranslations } from "next-intl/server";
import { deleteShout } from "@/actions/admin-radio-moderation";
import { StatusCard } from "@/components/admin/dashboard";
import { Button } from "@/components/ui/button";
import { db, RadioShouts } from "@/lib/db";
import { formatDate } from "@/lib/format-date";
import { prisma } from "@/lib/prisma";
type Shout = {
id: bigint;
@@ -18,17 +19,17 @@ export default async function AdminRadioModerationPage() {
let shouts: Shout[] = [];
try {
shouts = await prisma.radioShouts.findMany({
select: {
id: true,
userId: true,
message: true,
createdAt: true,
updatedAt: true,
},
orderBy: { id: "desc" },
take: 50,
});
shouts = await db
.select({
id: RadioShouts.id,
userId: RadioShouts.userId,
message: RadioShouts.message,
createdAt: RadioShouts.createdAt,
updatedAt: RadioShouts.updatedAt,
})
.from(RadioShouts)
.orderBy(desc(RadioShouts.id))
.limit(50);
} catch {
shouts = [];
}