// app/api/documents/[id]/route.ts import prisma from "@/app/lib/prisma"; import { NextResponse } from "next/server"; export async function PUT( request: Request, { params }: { params: { id: string } } ) { try { const { content, title } = await request.json(); const document = await prisma.document.update({ where: { id: params.id, }, data: { content, title, updatedAt: new Date(), }, }); return NextResponse.json(document); } catch (error) { console.error("Error saving document:", error); return NextResponse.json( { error: "Failed to save document" }, { status: 500 } ); } }