refactor(db): migrate app pages and APIs from Prisma facade to Drizzle (2)
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { asc, eq } from "drizzle-orm";
|
||||
import { redirect } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { db, WebsiteEventType } from "@/lib/db";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { EventForm } from "../event-form";
|
||||
|
||||
export default async function CreateEventPage() {
|
||||
@@ -11,10 +12,11 @@ export default async function CreateEventPage() {
|
||||
}
|
||||
|
||||
const t = await getTranslations("pages.admin.events");
|
||||
const eventTypes = await prisma.websiteEventType.findMany({
|
||||
where: { isActive: 1 },
|
||||
orderBy: { name: "asc" },
|
||||
});
|
||||
const eventTypes = await db
|
||||
.select()
|
||||
.from(WebsiteEventType)
|
||||
.where(eq(WebsiteEventType.isActive, 1))
|
||||
.orderBy(asc(WebsiteEventType.name));
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
|
||||
Reference in New Issue
Block a user