rollback change in master
This commit is contained in:
@@ -4,7 +4,6 @@ const { Books } = cds.entities
|
|||||||
/** Service implementation for CatalogService */
|
/** Service implementation for CatalogService */
|
||||||
module.exports = cds.service.impl(function() {
|
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', _checkOrderCreateAuth)
|
|
||||||
this.before ('CREATE', 'Orders', _reduceStock)
|
this.before ('CREATE', 'Orders', _reduceStock)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -24,8 +23,4 @@ async function _reduceStock (req) {
|
|||||||
`${OrderItems[i].amount} exceeds stock for book #${OrderItems[i].book_ID}`
|
`${OrderItems[i].amount} exceeds stock for book #${OrderItems[i].book_ID}`
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
}
|
|
||||||
/** Check authorization */
|
|
||||||
function _checkOrderCreateAuth (req) {
|
|
||||||
req.user.country === req.data.country || req.reject(403)
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user