-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathexternal.cds
40 lines (35 loc) · 1.18 KB
/
external.cds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using { API_BUSINESS_PARTNER as external } from './external/API_BUSINESS_PARTNER';
/**
* Tailor the imported API to our needs...
*/
extend service external with {
/**
* Add asynchronous eventing API
*/
@topic: 'sap.s4.beh.businesspartner.v1.BusinessPartner.Changed.v1'
event BusinessPartner.Changed {
BusinessPartner: String;
}
}
/**
* Simplified view on external addresses, which in addition acts as a table to store replicated external address data.
*/
@cds.persistence:{table,skip:false} //> create a table with the view's inferred signature
@cds.autoexpose //> auto-expose in services as targets for ValueHelps and joins
entity my.bookshop.Addresses as projection on external.A_BusinessPartnerAddress {
key AddressID as ID,
key BusinessPartner as businessPartner,
@readonly Country as country,
@readonly CityName as city,
@readonly PostalCode as postalCode,
@readonly StreetName as street,
@readonly HouseNumber as houseNumber,
false as tombstone: Boolean
}
/*
* Extend Orders with references to replicated external Addresses
*/
using { my.bookshop.Orders } from '../db/index';
extend Orders with {
shippingAddress : Association to my.bookshop.Addresses;
}