Fix build errors for Next.js 16 + Prisma 7

- Fix Prisma import: use @/generated/prisma alias (resolves Turbopack issue)
- Replace middleware.ts with proxy.ts (Next.js 16 convention)
- middleware function renamed to proxy

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-07 10:40:59 +05:00
parent 8d3ff24e52
commit 024cf7adac
2 changed files with 3 additions and 14 deletions
-39
View File
@@ -1,39 +0,0 @@
import { NextRequest, NextResponse } from "next/server";
import { getSessionCookie } from "better-auth/cookies";
const PUBLIC_ROUTES = [
"/login",
"/register",
"/verify-email",
"/api/auth",
];
const ROLE_ROUTES: Record<string, string[]> = {
admin: ["/admin"],
curator: ["/curator", "/admin"],
};
export async function middleware(request: NextRequest) {
const { pathname } = request.nextUrl;
// Allow public routes and static assets
if (
PUBLIC_ROUTES.some((route) => pathname.startsWith(route)) ||
pathname.startsWith("/_next") ||
pathname.startsWith("/favicon")
) {
return NextResponse.next();
}
const sessionCookie = getSessionCookie(request);
if (!sessionCookie) {
return NextResponse.redirect(new URL("/login", request.url));
}
return NextResponse.next();
}
export const config = {
matcher: ["/((?!_next/static|_next/image|favicon.ico).*)"],
};