import { NextResponse } from 'next/server';
import { PrismaClient } from '@/app/generated/prisma';

export async function GET() {
  const prisma = new PrismaClient();
  try {
    const handles = await prisma.userHandle.findMany({
      orderBy: { createtime: 'desc' },
      select: { id: true, email: true, handle: true, isApproved: true, createtime: true, icon: true }
    });
    return NextResponse.json({ items: handles });
  } catch (e) {
    console.error('admin user_handles 오류:', e);
    return NextResponse.json({ error: '조회 실패' }, { status: 500 });
  } finally {
    await prisma.$disconnect();
  }
}


