From 92bd15a8eab0db0ff1b4dcb5a3242da09ce54870 Mon Sep 17 00:00:00 2001 From: joshMANUmartin Date: Tue, 26 Nov 2024 12:01:37 -0800 Subject: [PATCH] fixed edit --- src/app/api/vendors/route.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/api/vendors/route.js b/src/app/api/vendors/route.js index 770deaa..e2ae3da 100644 --- a/src/app/api/vendors/route.js +++ b/src/app/api/vendors/route.js @@ -74,7 +74,7 @@ export async function DELETE(req) { export async function PUT(req) { const db = await openDB(); - const { id, vendor_name = '', vendor_description = '', building = '', floor = '', room = '' } = await req.json(); + const { id, vendor_name = '', vendor_description = '', building = '', floor = '', room = '', age_range = '', time_frame = ''} = await req.json(); if (!id) { return NextResponse.json({ message: 'Vendor ID is required' }, { status: 400 }); @@ -83,8 +83,8 @@ export async function PUT(req) { try { // Update the vendor in the database, allowing empty fields await db.run( - 'UPDATE vendors SET vendor_name = ?, vendor_description = ?, building = ?, floor = ?, room = ? WHERE id = ?', - [vendor_name, vendor_description, building, floor, room, id] + 'UPDATE vendors SET vendor_name = ?, vendor_description = ?, building = ?, floor = ?, room = ?, age_range = ?, time_frame = ? WHERE id = ?', + [vendor_name, vendor_description, building, floor, room, age_range, time_frame, id] ); return NextResponse.json({ message: 'Vendor updated successfully' });