import { redirect } from "next/navigation"; import { auth } from "@/auth"; import { prisma } from "@/lib/db"; import type { ProfileDTO } from "@/types/profile"; import { ProfileForm } from "@/components/profile/profile-form"; export default async function ProfilePage() { const session = await auth(); // Defense in depth: proxy.ts already redirects unauthenticated requests, // but every protected data boundary should check for itself too. if (!session?.user) redirect("/login"); const user = await prisma.user.findUnique({ where: { id: session.user.id }, select: { firstName: true, lastName: true, avatar: true }, }); if (!user) redirect("/login"); const profile: ProfileDTO = { firstName: user.firstName, lastName: user.lastName, avatar: user.avatar, }; return (

Profile

Your name and photo, shown in the menu on the left.

); }