Files
Converge/src/app/api/portfolio/route.ts

11 lines
501 B
TypeScript

import { NextResponse } from "next/server";
import { getAssessment, getCatalog, listAssessments } from "@/lib/store";
import { buildPortfolio } from "@/lib/portfolio";
import type { Assessment } from "@/lib/types";
export async function GET() {
const [summaries, catalog] = await Promise.all([listAssessments(), getCatalog()]);
const all = (await Promise.all(summaries.map((s) => getAssessment(s.id)))).filter(Boolean) as Assessment[];
return NextResponse.json(buildPortfolio(all, catalog));
}