cleaner
This commit is contained in:
@@ -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