Switched to warehouseArea naming

This commit is contained in:
Tim Howitz 2025-06-06 18:18:26 +01:00
parent 4728e6ff05
commit 4df13145eb
3 changed files with 8 additions and 8 deletions

View File

@ -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,
},

View File

@ -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,
},
});

View File

@ -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,
},