Moved to chinook + added .env

This commit is contained in:
Daniel
2020-12-16 10:58:53 +01:00
committed by Daniel Hutzel
parent 5cec82fa00
commit 69e510a407
136 changed files with 6 additions and 5 deletions

View File

@@ -1,12 +0,0 @@
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
}