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

export async function POST(_: Request, context: { params: Promise<{ id: string }> }) {
  const { id } = await context.params;
  const reqItem = await prisma.partnerRequest.update({ where: { id }, data: { status: "approved", approvedAt: new Date() } });
  // 승인 시 실제 파트너 등록
  await prisma.partner.create({ data: { name: reqItem.name, category: reqItem.category, latitude: reqItem.latitude, longitude: reqItem.longitude, address: reqItem.address ?? undefined } });
  return NextResponse.json({ request: reqItem });
}


