Cosmetics 2
This commit is contained in:
@@ -21,8 +21,8 @@ async function _reduceStock (req) {
|
|||||||
.set ('stock -=', item.amount)
|
.set ('stock -=', item.amount)
|
||||||
.where ('ID =', item.book_ID) .and ('stock >=', item.amount)
|
.where ('ID =', item.book_ID) .and ('stock >=', item.amount)
|
||||||
)).then (all => all.forEach ((affectedRows,i) => {
|
)).then (all => all.forEach ((affectedRows,i) => {
|
||||||
if (affectedRows === 0) req.error (409,
|
if (affectedRows === 0) {
|
||||||
`${orderItems[i].amount} exceeds stock for book #${orderItems[i].book_ID}`
|
req.error (409, `${orderItems[i].amount} exceeds stock for book #${orderItems[i].book_ID}`)
|
||||||
)
|
}
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user