Benefiting from cds.context

This commit is contained in:
Daniel
2020-12-17 16:39:01 +01:00
parent 86e5c429bd
commit 9e45ac2f0c
6 changed files with 20 additions and 26 deletions

View File

@@ -7,6 +7,6 @@ module.exports = cds.service.impl (function(){
/** 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'))
const {ID} = await SELECT.one.from(req.target).columns('max(ID) as ID')
req.data.ID = ID - ID % 100 + 100 + 1
}