2024-07-30 21:34:39 +02:00
|
|
|
import { NextResponse } from "next/server";
|
|
|
|
import clientPromise from "@/lib/db";
|
|
|
|
|
|
|
|
// Force the API to use SSR instead of static generation
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
|
|
|
|
export async function POST(request: Request) {
|
2024-09-07 09:12:48 +02:00
|
|
|
const body = await request.json();
|
|
|
|
const { version, date, bullets } = body;
|
2024-07-30 21:34:39 +02:00
|
|
|
|
2024-09-07 09:12:48 +02:00
|
|
|
const client = await clientPromise;
|
|
|
|
const db = client.db("downloadsDatabase");
|
2024-07-30 21:34:39 +02:00
|
|
|
|
2024-09-07 09:12:48 +02:00
|
|
|
const result = await db.collection("vulnerabilities").insertOne({
|
|
|
|
version,
|
|
|
|
bullets
|
|
|
|
});
|
2024-07-30 21:34:39 +02:00
|
|
|
|
2024-09-07 09:12:48 +02:00
|
|
|
return NextResponse.json({ success: true, id: result.insertedId });
|
2024-07-30 21:34:39 +02:00
|
|
|
}
|