Merge pull request #11 from DorianNiemiecSVRJS/main

Fix vulnerability deletion API.
This commit is contained in:
Abhijit Bhattacharjee 2024-08-09 17:16:28 +05:30 committed by GitHub
commit f46d0f00a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,8 +6,6 @@ export async function DELETE(
request: Request, request: Request,
{ params }: { params: { id: string } } { params }: { params: { id: string } }
) { ) {
const client = await clientPromise;
const db = client.db();
const { id } = params; const { id } = params;
if (!id) { if (!id) {
@ -15,6 +13,8 @@ export async function DELETE(
} }
try { try {
const client = await clientPromise;
const db = client.db("downloadsDatabase");
const result = await db const result = await db
.collection("vulnerabilities") .collection("vulnerabilities")
.deleteOne({ _id: new ObjectId(id) }); .deleteOne({ _id: new ObjectId(id) });