Do no longer use run blocks - removed in cds 4

This commit is contained in:
Christian Georgi
2020-07-31 12:36:11 +02:00
committed by Christian Georgi
parent 5c5afd2790
commit 4b78a8b637

View File

@@ -7,7 +7,7 @@ module.exports = cds.service.impl(function() {
// Reduce stock of ordered books if available stock suffices
this.before ('CREATE', 'Orders', (req) => {
const { Items: OrderItems } = req.data
return cds.transaction(req) .run (()=> OrderItems.map (order =>
return cds.transaction(req) .run (OrderItems.map (order =>
UPDATE (Books) .where ('ID =', order.book_ID)
.and ('stock >=', order.amount)
.set ('stock -=', order.amount)