Next.js app for mapping a customer's competitive tool landscape onto our portfolio and building the consolidation business case: assessment workbench, customer report and Word export, product catalog, competitive knowledge base, dossier import, shareable landscape questionnaires with a review inbox, tool-footprint and business-unit value analysis, and an implementation timeline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
964 B
TypeScript
25 lines
964 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { createAssessment, listAssessments, saveAssessment } from "@/lib/store";
|
|
import type { Assessment } from "@/lib/types";
|
|
|
|
export async function GET() {
|
|
return NextResponse.json(await listAssessments());
|
|
}
|
|
|
|
export async function POST(req: Request) {
|
|
const body = await req.json().catch(() => ({}));
|
|
// An "import" payload carries a full candidate list; anything else is a fresh assessment.
|
|
if (body?.import) {
|
|
const src = body.import as Assessment;
|
|
const created = await createAssessment({ ...src, candidates: src.candidates ?? [] });
|
|
return NextResponse.json(created, { status: 201 });
|
|
}
|
|
return NextResponse.json(await createAssessment(body), { status: 201 });
|
|
}
|
|
|
|
export async function PUT(req: Request) {
|
|
const a = (await req.json()) as Assessment;
|
|
if (!a?.id) return NextResponse.json({ error: "Missing id" }, { status: 400 });
|
|
return NextResponse.json(await saveAssessment(a));
|
|
}
|