cleaner
This commit is contained in:
@@ -4,6 +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/xb-msg-amqp-v100": "latest",
|
||||
"@sap/cds": "latest",
|
||||
"express": "*"
|
||||
},
|
||||
@@ -18,10 +19,16 @@
|
||||
"API_BUSINESS_PARTNER": {
|
||||
"kind": "odata",
|
||||
"model": "srv/external/API_BUSINESS_PARTNER",
|
||||
"--credentials": {
|
||||
"credentials": {
|
||||
"destination": "cap-api098"
|
||||
}
|
||||
},
|
||||
"messaging": {
|
||||
"kind": "enterprise-messaging",
|
||||
"credentials": {
|
||||
"prefix": "sap/S4HANAOD/c098/BO"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ service CatalogService {
|
||||
} excluding { createdBy, modifiedBy };
|
||||
|
||||
@readonly entity Addresses as projection on A_BusinessPartnerAddress {
|
||||
key AddressID,
|
||||
key AddressID as ID,
|
||||
key BusinessPartner,
|
||||
StreetName,
|
||||
HouseNumber,
|
||||
@@ -18,8 +18,8 @@ service CatalogService {
|
||||
Country
|
||||
};
|
||||
|
||||
event OrdersOutdated {
|
||||
orders: array of my.Orders
|
||||
event OrderOutdated {
|
||||
ID: UUID;
|
||||
};
|
||||
|
||||
@requires_: 'authenticated-user'
|
||||
|
||||
@@ -10,9 +10,8 @@ module.exports = cds.service.impl(async function () {
|
||||
bupaSrv.on('BusinessPartner/Changed', async msg => {
|
||||
console.log('>> Received message', msg.data)
|
||||
const BUSINESSPARTNER = msg.data.KEY[0].BUSINESSPARTNER
|
||||
const orders = await cds.tx(msg).run(SELECT.from(Orders).where({ createdBy: BUSINESSPARTNER }))
|
||||
this.emit('OrdersOutdated', { orders })
|
||||
console.log('<< Emitting message', { orders })
|
||||
const orders = await cds.tx(msg).run(SELECT('ID').from(Orders).where({ createdBy: BUSINESSPARTNER }))
|
||||
orders.forEach(order => this.emit('OrderOutdated', order) && console.log('<< Emitting message', order))
|
||||
})
|
||||
|
||||
/** Add some discount for overstocked books */
|
||||
|
||||
Reference in New Issue
Block a user