feat(api): POST /api/insights/[id]/status (status + optional notes)

This commit is contained in:
Semih
2026-05-14 11:58:30 +00:00
parent a713505f44
commit b38721bb05
2 changed files with 20 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
import { NextResponse } from "next/server";
import { setStatus, setFounderNotes } from "@/app/insights/_actions";
export const dynamic = "force-dynamic";
// POST /api/insights/[id]/status { status, notes? }
export async function POST(req: Request, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const body = (await req.json().catch(() => ({}))) as { status?: string; notes?: string };
if (!body.status) return NextResponse.json({ ok: false, error: "missing_status" }, { status: 400 });
try {
await setStatus(id, body.status);
if (body.notes) await setFounderNotes(id, body.notes);
return NextResponse.json({ ok: true });
} catch (e) {
return NextResponse.json({ ok: false, error: (e as Error).message }, { status: 500 });
}
}

File diff suppressed because one or more lines are too long