Files
Neon-Desk/frontend/app/api/portfolio/insights/latest/route.ts

11 lines
305 B
TypeScript

import { getStoreSnapshot } from '@/lib/server/store';
export async function GET() {
const snapshot = await getStoreSnapshot();
const insight = snapshot.insights
.slice()
.sort((a, b) => Date.parse(b.created_at) - Date.parse(a.created_at))[0] ?? null;
return Response.json({ insight });
}