returning subfolders names

This commit is contained in:
Dmitriynj
2020-12-23 13:38:09 +03:00
committed by Daniel Hutzel
parent 9d28ca9844
commit 9abeb67d82
41 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
const cds = require('@sap/cds')
module.exports = cds.service.impl (function(){
this.before ('NEW','Authors', genid)
this.before ('NEW','Books', genid)
})
/** Generate primary keys for target entity in request */
async function genid (req) {
const {ID} = await cds.tx(req).run (SELECT.one.from(req.target).columns('max(ID) as ID'))
req.data.ID = ID - ID % 100 + 100 + 1
}