This commit is contained in:
Daniel
2019-12-16 21:50:23 +01:00
parent dfea19334d
commit 5720d73b76
9 changed files with 184 additions and 170 deletions

View File

@@ -1,6 +1,5 @@
namespace sap.capire.bookshop;
using { Currency, managed, cuid } from '@sap/cds/common';
using { API_BUSINESS_PARTNER as external } from '../srv/external/API_BUSINESS_PARTNER';
entity Books : managed {
key ID : Integer;
@@ -8,7 +7,7 @@ entity Books : managed {
descr : localized String(1111);
author : Association to Authors;
stock : Integer;
price : Decimal(9,2);
price : Decimal;
currency : Currency;
}
@@ -25,24 +24,12 @@ entity Authors : managed {
entity Orders : cuid, managed {
OrderNo : String @title:'Order Number'; //> readable key
Items : Composition of many OrderItems on Items.parent = $self;
total : Decimal(9,2) @readonly;
total : Decimal @readonly;
currency : Currency;
shippingAddress : Association to one ShippingAddresses;
}
entity OrderItems : cuid {
parent : Association to Orders;
book : Association to Books;
amount : Integer;
netAmount : Decimal(9,2);
netAmount : Decimal;
}
@cds.persistence: {table, skip: false}
entity ShippingAddresses as projection on external.A_BusinessPartnerAddress {
key AddressID,
key BusinessPartner,
Country as country,
CityName as cityName,
PostalCode as postalCode,
StreetName as streetName,
HouseNumber as houseNumber
}