Use preferred .after('each', ...) handler (#701)
This commit is contained in:
@@ -4,8 +4,8 @@ module.exports = class CatalogService extends cds.ApplicationService { init() {
|
|||||||
const { ListOfBooks } = this.entities
|
const { ListOfBooks } = this.entities
|
||||||
|
|
||||||
// Add some discount for overstocked books
|
// Add some discount for overstocked books
|
||||||
this.after('READ', ListOfBooks, each => {
|
this.after('each', ListOfBooks, book => {
|
||||||
if (each.stock > 111) each.title += ` -- 11% discount!`
|
if (book.stock > 111) book.title += ` -- 11% discount!`
|
||||||
})
|
})
|
||||||
|
|
||||||
// Reduce stock of ordered books if available stock suffices
|
// Reduce stock of ordered books if available stock suffices
|
||||||
|
|||||||
Reference in New Issue
Block a user