Fix: Strip virtual fields (orderedQty, remainingStock) before saving stock to DB

This commit is contained in:
Quintine committed 2026-05-20 15:10:22 +10:00
1 parent 996126c622
commit 13b21356ee
1 file changed
+1 -1
+1 -1
View File
@@ -137,7 +137,7 @@ app.delete('/api/orders', async (req, res) => {
// Update or Create Stock Item
app.post('/api/stock', async (req, res) => {
try {
const item = req.body;
const { orderedQty, remainingStock, ...item } = req.body; // strip virtual fields
if (item.id) {
const updated = await prisma.stockItem.update({
where: { id: item.id },