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

export async function GET() {
  // 통합: 승인된 파트너 요청을 메인 노출용으로 사용
  const rows = await prisma.partnerRequest.findMany({
    where: { status: "approved", active: true },
    orderBy: [{ sortOrder: "asc" }, { createdAt: "desc" }],
    select: { id: true, region: true, name: true, address: true, imageUrl: true, sortOrder: true, active: true, category: true },
  });
  const items = rows.map((r) => ({ id: r.id, region: r.region || "", name: r.name, address: r.address || "", imageUrl: r.imageUrl || "", sortOrder: r.sortOrder, active: r.active, category: r.category }));
  return NextResponse.json({ items });
}


