import { NextResponse } from "next/server";
import prisma from "@/lib/prisma";
import { getUserIdOrAdmin } from "@/lib/auth";

export async function GET(req: Request) {
  const userId = await getUserIdOrAdmin(req);
  if (!userId) return NextResponse.json({ user: null });
  const user = await prisma.user.findUnique({
    where: { userId },
    select: {
      userId: true,
      nickname: true,
      profileImage: true,
      points: true,
      level: true,
      grade: true,
    },
  });
  return NextResponse.json({ user });
}


