import { listForPortfolio } from "@/lib/bulkUpload/server";
import { NextRequest, NextResponse } from "next/server";

export async function GET(
  _request: NextRequest,
  { params }: { params: Promise<{ portfolioId: string }> }
) {
  const { portfolioId } = await params;

  try {
    const uploads = await listForPortfolio(portfolioId);
    return NextResponse.json(uploads, { status: 200 });
  } catch (error) {
    console.error("Failed to fetch bulk uploads:", error);
    return NextResponse.json({ error: "Internal server error" }, { status: 500 });
  }
}
