diff --git a/src/app/api/warehouse/edit-artefact/route.ts b/src/app/api/warehouse/edit-artefact/route.ts index 54c78f7..a6d4224 100644 --- a/src/app/api/warehouse/edit-artefact/route.ts +++ b/src/app/api/warehouse/edit-artefact/route.ts @@ -10,7 +10,7 @@ export async function POST(request: NextRequest) { const id = formData.get("id") as string; const name = formData.get("name") as string | null; const description = formData.get("description") as string | null; - const location = formData.get("location") as string | null; + const warehouseArea = formData.get("warehouseArea") as string | null; const earthquakeCode = formData.get("earthquakeCode") as string | null; const image = formData.get("image") as File | null; @@ -73,7 +73,7 @@ export async function POST(request: NextRequest) { data: { name: name || artefact.name, description: description || artefact.description, - warehouseArea: location || artefact.warehouseArea, + warehouseArea: warehouseArea || artefact.warehouseArea, earthquakeId, imageName, }, diff --git a/src/app/api/warehouse/log-bulk/route.ts b/src/app/api/warehouse/log-bulk/route.ts index cc0e27e..60b647d 100644 --- a/src/app/api/warehouse/log-bulk/route.ts +++ b/src/app/api/warehouse/log-bulk/route.ts @@ -5,7 +5,7 @@ import { prisma } from "@utils/prisma"; export async function POST(request: NextRequest) { try { const body = await request.json(); - const { palletNote, warehouseLocation } = body; + const { palletNote, warehouseArea } = body; const authResult = await apiAuthMiddleware(); if ("user" in authResult === false) return authResult; // Handle error response @@ -31,14 +31,14 @@ export async function POST(request: NextRequest) { } } - if (!palletNote || !warehouseLocation) { + if (!palletNote || !warehouseArea) { return NextResponse.json({ error: "Missing fields" }, { status: 400 }); } await prisma.pallet.create({ data: { palletNote, - warehouseArea: warehouseLocation, + warehouseArea, }, }); diff --git a/src/app/api/warehouse/log/route.ts b/src/app/api/warehouse/log/route.ts index af3415c..fad5612 100644 --- a/src/app/api/warehouse/log/route.ts +++ b/src/app/api/warehouse/log/route.ts @@ -11,7 +11,7 @@ export async function POST(request: NextRequest) { const type = formData.get("type") as string; const description = formData.get("description") as string; const earthquakeCode = formData.get("earthquakeCode") as string; - const warehouseLocation = formData.get("warehouseLocation") as string; + const warehouseArea = formData.get("warehouseArea") as string; const image = formData.get("image") as File | null; const authResult = await apiAuthMiddleware(); @@ -19,7 +19,7 @@ export async function POST(request: NextRequest) { const { user } = authResult; - if (!name || !type || !description || !earthquakeCode || !warehouseLocation) { + if (!name || !type || !description || !earthquakeCode || !warehouseArea) { return NextResponse.json({ error: "Missing fields" }, { status: 400 }); } @@ -63,7 +63,7 @@ export async function POST(request: NextRequest) { type, description, earthquakeId: linkedEarthquake.id, - warehouseArea: warehouseLocation, + warehouseArea: warehouseArea, imageName, creatorId: user.id, },