fix: retrofit AssetItem.model to modelId FK
AssetItem.model was a free-text string with no referential integrity. Now a required FK to AssetModel, mirroring the Request.employeeId and License.vendorId retrofit precedent (no backfill needed, no real AssetItem data existed).
This commit is contained in:
@@ -22,11 +22,11 @@ export async function POST(request: Request): Promise<NextResponse> {
|
||||
return NextResponse.json({ error: "Request body must be a JSON object" }, { status: 400 });
|
||||
}
|
||||
|
||||
const { serialNumber, model, purchaseDate, warrantyEndDate, purchaseOrderId } =
|
||||
const { serialNumber, modelId, purchaseDate, warrantyEndDate, purchaseOrderId } =
|
||||
body as Record<string, unknown>;
|
||||
const validation = validateCreateAssetItemInput({
|
||||
serialNumber,
|
||||
model,
|
||||
modelId,
|
||||
purchaseDate,
|
||||
warrantyEndDate,
|
||||
purchaseOrderId,
|
||||
|
||||
Reference in New Issue
Block a user