VIBN Frontend for Coolify deployment
This commit is contained in:
28
app/api/projects/[projectId]/aggregate/route.ts
Normal file
28
app/api/projects/[projectId]/aggregate/route.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { buildCanonicalProductModel } from '@/lib/server/product-model';
|
||||
|
||||
export async function POST(
|
||||
_request: Request,
|
||||
{ params }: { params: Promise<{ projectId: string }> },
|
||||
) {
|
||||
try {
|
||||
const { projectId } = await params;
|
||||
if (!projectId) {
|
||||
return NextResponse.json({ error: 'Missing projectId' }, { status: 400 });
|
||||
}
|
||||
|
||||
const canonicalProductModel = await buildCanonicalProductModel(projectId);
|
||||
return NextResponse.json({ canonicalProductModel });
|
||||
} catch (error) {
|
||||
console.error('[aggregate] Failed to build canonical product model', error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: 'Failed to aggregate product signals',
|
||||
details: error instanceof Error ? error.message : String(error),
|
||||
},
|
||||
{ status: 500 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user