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

+12 -7
View File
@@ -1,11 +1,12 @@
import { desc, eq } from "drizzle-orm";
import { redirect } from "next/navigation";
import { getTranslations } from "next-intl/server";
import type { CSSProperties } from "react";
import { applyDj } from "@/actions/radio-apply";
import { ContentCard } from "@/components/public/ui";
import { auth } from "@/lib/auth";
import { db, RadioApplications } from "@/lib/db";
import { formatDate } from "@/lib/format-date";
import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
@@ -49,13 +50,17 @@ export default async function RadioApplyPage({
// Surface the applicant's most recent application (if any) so they aren't
// left guessing. Isolated query: a DB hiccup degrades this to null, not 500.
const existing = await prisma.radioApplications
.findFirst({
where: { userId: BigInt(userId) },
orderBy: { id: "desc" },
select: { id: true, status: true, createdAt: true },
const [existing] = await db
.select({
id: RadioApplications.id,
status: RadioApplications.status,
createdAt: RadioApplications.createdAt,
})
.catch(() => null);
.from(RadioApplications)
.where(eq(RadioApplications.userId, BigInt(userId)))
.orderBy(desc(RadioApplications.id))
.limit(1)
.catch(() => []);
const submittedDate = existing?.createdAt
? formatDate(existing.createdAt, "date")