Cosmetics 2

This commit is contained in:
Christian Georgi
2020-02-11 07:55:46 +00:00
parent d54b16bd94
commit eb5334cafc

View File

@@ -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}`)
) }
})) }))
} }