Initial commit: Converge portfolio rationalization app
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>
This commit is contained in:
21
src/app/api/catalog/route.ts
Normal file
21
src/app/api/catalog/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getCatalog, saveCatalog } from "@/lib/store";
|
||||
import type { Catalog } from "@/lib/types";
|
||||
|
||||
export async function GET() {
|
||||
return NextResponse.json(await getCatalog());
|
||||
}
|
||||
|
||||
export async function PUT(req: Request) {
|
||||
const body = (await req.json()) as Catalog;
|
||||
if (!Array.isArray(body?.products) || !Array.isArray(body?.businessUnits)) {
|
||||
return NextResponse.json({ error: "Malformed catalog" }, { status: 400 });
|
||||
}
|
||||
const ids = new Set<string>();
|
||||
for (const p of body.products) {
|
||||
if (!p.id || !p.name) return NextResponse.json({ error: "Product needs an id and a name" }, { status: 400 });
|
||||
if (ids.has(p.id)) return NextResponse.json({ error: `Duplicate product id: ${p.id}` }, { status: 400 });
|
||||
ids.add(p.id);
|
||||
}
|
||||
return NextResponse.json(await saveCatalog(body));
|
||||
}
|
||||
Reference in New Issue
Block a user