prettier
This commit is contained in:
@@ -3,11 +3,7 @@ const { Books } = cds.entities
|
||||
|
||||
/** Service implementation for CatalogService */
|
||||
module.exports = cds.service.impl(function () {
|
||||
this.after(
|
||||
'READ',
|
||||
'Books',
|
||||
each => each.stock > 111 && _addDiscount2(each, 11)
|
||||
)
|
||||
this.after('READ', 'Books', each => each.stock > 111 && _addDiscount2(each, 11))
|
||||
this.before('CREATE', 'Orders', _reduceStock)
|
||||
})
|
||||
|
||||
@@ -28,12 +24,6 @@ async function _reduceStock (req) {
|
||||
)
|
||||
)
|
||||
all.forEach((affectedRows, i) => {
|
||||
if (affectedRows === 0)
|
||||
req.error(
|
||||
409,
|
||||
`${OrderItems[i].amount} exceeds stock for book #${
|
||||
OrderItems[i].book_ID
|
||||
}`
|
||||
)
|
||||
if (affectedRows === 0) req.error(409, `${OrderItems[i].amount} exceeds stock for book #${OrderItems[i].book_ID}`)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user