Fix: Strip virtual fields (orderedQty, remainingStock) before saving stock to DB
This commit is contained in:
1 parent
996126c622
commit
13b21356ee
1 file changed
+1
-1
@@ -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 },
|
||||
|
||||
Reference in new issue
Block a user