import NextAuth from "next-auth" import { PrismaAdapter } from "@auth/prisma-adapter" import { db } from "@/lib/db" import authConfig from "@/auth.config" export const { handlers: { GET, POST }, auth, signIn, signOut, } = NextAuth({ events: { async linkAccount({ user }) { await db.user.update({ where: {id: user.id }, data: { emailVerified: new Date() } }) } }, callbacks: { async session({ session, user, token }) { if (token.sub && session.user) { session.user.id = token.sub } return session }, async jwt({ token, user, account, profile, isNewUser }) { return token } }, adapter: PrismaAdapter(db), session: { strategy: "jwt" }, ...authConfig, })