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.", "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", "license": "SAP SAMPLE CODE LICENSE",
"dependencies": { "dependencies": {
"@sap/cds": "latest", "@sap/cds": "git://github.wdf.sap.corp/cdx/cds#snapi",
"@sap/xb-msg-amqp-v100": "^0.9.31-SNAPSHOT", "@sap/xb-msg-amqp-v100": "^0.9.31-SNAPSHOT",
"express": "*", "express": "*",
"passport": "^0.4.0", "passport": "^0.4.0",
@@ -17,8 +17,9 @@
"requires": { "requires": {
"API_BUSINESS_PARTNER": { "API_BUSINESS_PARTNER": {
"kind": "odata", "kind": "odata",
"model": "srv/external/API_BUSINESS_PARTNER", "model": "srv/external",
"--credentials": { ">>": "should go to bindings !!!", "--credentials": {
">>": "should go to bindings !!!",
"destination": "cap-api532", "destination": "cap-api532",
"prefix": "sap/S4HANAOD/c532/BO" "prefix": "sap/S4HANAOD/c532/BO"
} }
@@ -29,7 +30,9 @@
"strategy": "mock", "strategy": "mock",
"users": { "users": {
"alice": { "alice": {
"roles": ["admin"], "roles": [
"admin"
],
"password": "secret", "password": "secret",
"ID": "ALICE" "ID": "ALICE"
} }

View File

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