async conntext

This commit is contained in:
D065023
2019-12-20 16:11:10 +01:00
parent ed814a1f75
commit aa919f9d62
2 changed files with 11 additions and 8 deletions

View File

@@ -4,7 +4,7 @@
"description": "A simple bookshop application, build in a self-contained all-in-one fashion, i.e. w/o reusing other packages.",
"license": "SAP SAMPLE CODE LICENSE",
"dependencies": {
"@sap/cds": "latest",
"@sap/cds": "git://github.wdf.sap.corp/cdx/cds#snapi",
"@sap/xb-msg-amqp-v100": "^0.9.31-SNAPSHOT",
"express": "*",
"passport": "^0.4.0",
@@ -17,8 +17,9 @@
"requires": {
"API_BUSINESS_PARTNER": {
"kind": "odata",
"model": "srv/external/API_BUSINESS_PARTNER",
"--credentials": { ">>": "should go to bindings !!!",
"model": "srv/external",
"--credentials": {
">>": "should go to bindings !!!",
"destination": "cap-api532",
"prefix": "sap/S4HANAOD/c532/BO"
}
@@ -29,7 +30,9 @@
"strategy": "mock",
"users": {
"alice": {
"roles": ["admin"],
"roles": [
"admin"
],
"password": "secret",
"ID": "ALICE"
}

View File

@@ -1,10 +1,10 @@
const cds = require('@sap/cds')
module.exports = cds.service.impl (()=>{
module.exports = cds.service.impl (async ()=>{
// We are mashing up three services...
const admin = cds.connect.to ('AdminService')
const bupa = cds.connect.to ('API_BUSINESS_PARTNER')
const db = cds.connect.to ('db')
const admin = await cds.connect.to ('AdminService')
const bupa = await cds.connect.to ('API_BUSINESS_PARTNER')
const db = await cds.connect.to ('db')
// Using reflected definitions from connected services/database
const { Addresses: externalAddresses } = bupa.entities // projection on external addresses