import { NextResponse } from "next/server"; import { sql } from "@/db"; export async function GET(_req: Request, { params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const profiles = await sql` SELECT * FROM member_profiles WHERE slug = ${slug} AND is_public = true LIMIT 1 `; if (!profiles[0]) return NextResponse.json({ error: "Not found" }, { status: 404 }); const profile = profiles[0]; const products = await sql` SELECT * FROM recommended_products WHERE profile_id = ${profile.id} AND is_active = true ORDER BY display_order ASC `; return NextResponse.json({ profile, products }); }