import { NextResponse } from "next/server"; import { linkTermToBlock } from "../../../../../lib/db/repo"; interface RouteContext { params: Promise<{ projectId: string }>; } export async function POST(req: Request, _ctx: RouteContext) { let body: { termId?: string; blockId?: string | null } = {}; try { body = await req.json(); } catch { return NextResponse.json({ error: "Invalid JSON" }, { status: 400 }); } if (!body.termId) { return NextResponse.json({ error: "Missing termId" }, { status: 400 }); } await linkTermToBlock(body.termId, body.blockId ?? null); return NextResponse.json({ ok: true }); }