First push
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
async function run() {
|
||||
debugger
|
||||
while (true) {}
|
||||
process.exit()
|
||||
//debugger
|
||||
//while (true) {}
|
||||
//process.exit()
|
||||
//1.substring()
|
||||
let res = await cds.read(SELECT.one`title`.from(`Books`).where(`ID=201`))
|
||||
let { title } = res
|
||||
const data = req.data
|
||||
data.modifiedBy = "Custom Event handler read changed this!";
|
||||
data.placeOfDeath = ' --- Somewhere over ' + title + ' --- create in Sandbox'
|
||||
data.modifiedBy = "Custom Event handler read changed this!"
|
||||
data.placeOfDeath = " --- Somewhere over " + title + " --- create in Sandbox"
|
||||
return data
|
||||
}
|
||||
output = run()
|
||||
|
||||
5
bookshop/handlers/AdminService.Authors.READ.js
Normal file
5
bookshop/handlers/AdminService.Authors.READ.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const result_ = Array.isArray(result) ? result : [result]
|
||||
for (const row of result_) {
|
||||
row.modifiedBy += " --- read in sandbox"
|
||||
row.age = 27
|
||||
}
|
||||
9
bookshop/handlers/AdminService.Books.CREATE.js
Normal file
9
bookshop/handlers/AdminService.Books.CREATE.js
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
async function run() {
|
||||
const {stock, price, author_ID} = req.data
|
||||
if (stock<0) return req.reject('409', 'Stock must not be negative')
|
||||
if (price<0) return req.reject('409', 'Price must not be negative')
|
||||
let {name} = await SELECT.one`name`.from(`Authors`).where({ID: author_ID})
|
||||
req.data.authorName=name
|
||||
}
|
||||
output = run()
|
||||
6
bookshop/handlers/AdminService.Books.READ.js
Normal file
6
bookshop/handlers/AdminService.Books.READ.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const result_ = Array.isArray(result) ? result : [result];
|
||||
for (const row of result_) {
|
||||
if (row.stock > 50) {
|
||||
row.title += " ---Order now for a 10% discount!";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user